In my htaccess file I have the following redirections:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteRule index.html$ Controller/index.php [L]
</IfModule>
I want index.html (which does not exist) to be redirected to my controller. index.php (which exists) should be my home page.
Now, my homepage is not working when typing http://www.domain.com/ in my browser. That URL redirects to my controller. http://www.domain.com/index.php works fine, bringing my homepage.
How do I set index.php as my index file开发者_Go百科 keeping my redirection for the controller?
If I've understood your situation correctly, you just want to specify DirectoryIndex
in your .htaccess
file so that it only points to index.php
:
DirectoryIndex index.php
Between that and your rules, that leads to the following URL to file mappings:
http://www.example.com/ -> /index.php
http://www.example.com/index.php -> /index.php
http://www.example.com/index.html -> /Controller/index.php
精彩评论