I am very well aware that such type questions have already been asked many times but I think mine is a different one. I am a newbee to .htaccess
.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^localhost/index.php
RewriteRule (.*) localhost/index.php [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ leather-product.php?n=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^bagsgentssel1/([0-9]+)$ bagsgentssel1.php?h=$1 [L]
# RewriteRule . /index.php [L]
# RewriteRule ^bagsgentssel1/([0-9]+)$ bagsgentssel1.php?h=$1 [QSA,L]
# RewriteRule ^(.*)$ leather-product.php?n=$1 [QSA,L]
When I run my code RewriteRule ^(.*)$ leather-product.php?n=$1 [QSA,L]
, this works fine. But when I try to run the second rule RewriteRule ^bagsgentssel1/([0-9]+)$ bagsgentssel1.php?h=$1 [L]
, this does not work. No error is shown here and in the chrome browser URL is shown as http://localhost/bagsgentssel1/45
.
Interesting part is if I comment below code then the second RewriteRule ^bagsgentssel1/([0-9]+)$ bagsgentssel1.php?h=$1 [L]
works fine.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ leather-product.php?n=$1 [QSA,L]
I am unable to find where I've gone wrong?