Answer the question
In order to leave comments, you need to log in
Looping in mod_rewrite?
I would like to have such a config, but it naturally goes into an endless loop. Tell me how to treat?
# ***********************************************************************
# ***********************************************************************
# *** Все html, php, htm, tpl и папки (заканчивающиеся на /) ***
# *** переадресуем на index.php для обработки ЧПУ и защиты. ***
# *** (c) 2012 Mendel AKA Max Dyachenko. ***
# ***********************************************************************
# ***********************************************************************
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^.*\.html$ /index.php [QSA]
RewriteRule ^.*\.htm$ /index.php [QSA]
RewriteRule ^.*\.tpl$ /index.php [QSA]
RewriteRule ^.*/$ /index.php [QSA]
#
#RewriteCond %{THE_REQUEST} !"^index\.php$"
RewriteRule ^.*\.php$ /index.php [QSA]
Answer the question
In order to leave comments, you need to log in
Decision:
#
RewriteRule ^.*\.html$ /index.php [L,QSA]
RewriteRule ^.*\.htm$ /index.php [L,QSA]
RewriteRule ^.*\.tpl$ /index.php [L,QSA]
RewriteRule ^.*/$ /index.php [L,QSA]
#
RewriteCond %{REQUEST_FILENAME} !index\.php$
RewriteRule ^.*\.php$ /index.php [L,QSA]
Try to put the last line before:
RewriteRule ^.*\.html$ /index.php [QSA]
The directives will spin in a circle until the output is the same result 2 times.
L just stops the current iteration of processing mod_rewrite directives
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question