1

I want to redirect all request except like .html .js .jpg etc... For example www.mydomain.com/products should go to /index.php?p=cats&s=cars but www.mydomain.com/myproduct.html should go to www.mydomain.com/index.php?p=prod&s=myprod

my all redirects works fine but there is a problem. if i request without query string it's fall to infinitive loop my code is here. is there any solution for 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
anubhava
  • 761,203
  • 64
  • 569
  • 643
Yargicx
  • 1,704
  • 3
  • 16
  • 36

1 Answers1

0

Use it this 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]
anubhava
  • 761,203
  • 64
  • 569
  • 643