php - All redirects to infinite loop -
i want redirect request except .html .js .jpg etc... example www.mydomain.com/products should go /index.php?p=cats&s=cars www.mydomain.com/myproduct.html should go www.mydomain.com/index.php?p=prod&s=myprod
my redirects works fine there problem. if request without query string it's fall infinitive loop code here. there solution infinitive loop?
options +followsymlinks rewriteengine on rewritebase / rewritecond $1 !\. rewriterule ^(.*) index.php?p=cats&s=$1 rewriterule ^(.*).html$ index.php?p=prod-detail&p=$1
use way:
options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^.]+?)/?$ index.php?p=cats&s=$1 [l,qsa] rewritecond %{request_filename} !-f rewriterule ^(.+?)\.html$ index.php?p=prod-detail&p=$1 [l,qsa]
Comments
Post a Comment