neubert
neubert

Reputation: 16812

redirecting /index.php to / results in infinite loop

My .htaccess file contains this and only this:

Redirect 301 /index.php /

When I visit http://www.mydomain.com/ in Chrome I get this:

This webpage has a redirect loop

Any ideas?

Upvotes: 1

Views: 472

Answers (1)

Jon Lin
Jon Lin

Reputation: 143946

When mod_index takes the request / and maps it to /index.php, the Redirect statement that you have redirects it back to /. This is causing the loop. You can match against the actual request using mod_rewrite:

RewriteEngine On
RewriteCond %{THE_REQUEST} \ /index\.php
RewriteRule ^index\.php$ / [L,R=301]

Upvotes: 2

Related Questions