Report this

What is the reason for this report?

Redirecting domain.com/index.php to domain.com

Posted on December 11, 2017

Hi, I’ve been plugging away at this for almost 8 hours and can’t find a solution.

What I need to do is very standard. I just need /index.php to redirect or rewrite as domain.com

.htaccess files aren’t working even though I’ve allowed overrides in my VH.

I tried a different approach and just put the rewrite info right into VH which also failed as domain.com/index.php still resolves:

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/<ommitted>.co/public_html
	ServerName <ommitted>.co
	ServerAlias www.<ommitted>.co


	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	RewriteEngine on
	RewriteCond %{SERVER_NAME} =www.<ommitted>.co [OR]
	RewriteCond %{SERVER_NAME} =<ommitted>.co
	RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
	RewriteCond %{THE_REQUEST} ^.*/index\.php
	RewriteRule ^(.*)index.php$ /$1 [R=301,L]
</VirtualHost *:80>

I’ve read so many tutorials, I have to believe it’s something else causing the issue. A second set of eyes would be AWESOME.

Thanks.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.