Reputation: 328
Im sorry, my english is not very good but I'll try to explain my question.
So. 'index.php' is my main landing page.
A. Every request should go to index.php.
Its easy.RewriteRule .* index.php [L]
(simplified).
So when I write 'News/123' in addr bar then index.php will handle it and show me the news. It works fine.
B. But I also need to make '/index.php' entered in addr bar to be replaced by '/Home' and then -> A. I thought it can be done by Redirect /index.php /Main
but it causes an infinite redirection loop.
Can anyone help me with it?
Upvotes: 1
Views: 437
Reputation: 786291
You can use these rules in root .htaccess:
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^index\.php$ /home [L,R=302]
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php [L]
Upvotes: 1