Reputation: 371
My htaccess:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([^/.]+)/([^/.]+)(.*) /Application/?path=$1/$2$3 [L,QSA]
RewriteRule ^$ /Application/?path=ACFrontPage/getMainPage [L,QSA]
RewriteRule (.*) /Application/index.php?path=$1 [L,QSA]
This line causes infinite redirect:
RewriteRule (.*) /Application/index.php?path=$1 [L,QSA]
But I need if previous rules didn't match, to redirect everything to index.php file. How can I do it?
From logs its doing this:
split uri=/Application/?path=Application/ -> uri=/Application/, args=path=Application/&path=Application/&path=Application/&path=Application/&path=Application/&path=Application/&path=Application/&path=Application/&path=Application/&path=Application/
========================
@anubhava
I tried your suggested answer and it works for everything except base domain i.e.: http://example.com/
Upvotes: 1
Views: 84
Reputation: 784898
RewriteCond
is only applicable to very next RewriteRule
. Tweak your rules to avoid rewrites for all existing file or directories:
RewriteEngine On
RewriteRule ^$ /Application/?path=ACFrontPage/getMainPage [L]
# skip rewrite for all files/directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([^/.]+)/([^/.]+)(.*)$ /Application/?path=$1/$2$3 [L,QSA]
RewriteRule ^(.+)$ /Application/index.php?path=$1 [L,QSA]
Upvotes: 1