Question

I have the following code in my htaccess:

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^(.*)/(apply|ssl) [NC]
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

Everything is working fine. Except for the frontpage. If I access https://website.com it won't redirect the site to http//...

If I remove the line

RewriteCond %{REQUEST_FILENAME} !-d

it works. But then I get problems with my CMS on all https-pages with my php forms (apply/ssl).

Can someone help me? Anything that I'm missing why the frontpage won't redirect to http://?

Was it helpful?

Solution

Homepage ( / ) is treated as a directory, you can insert additional condition for it:

RewriteCond %{REQUEST_URI} ^/$ RewriteRule .* http://website.com/ [R=301,L]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top