Reputation: 6305
i have the following .htaccess file for me web
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)-(.*)-offers.html$ current-offers.php?id=$2 [L]
RewriteRule ^(.*)-(.*).html$ vpn-offer-detail.php?id=$2 [L]
RewriteRule ^(.*)-(.*)-details.html$ vpn-provider-detail.php?id=$2 [L]
I was actually trying to implement SEO freindly URLs through htaccess file. When I uploaded the file in my web directory, I stuck in something strange.
It looks like that rewrite rule 1 (for offers) is okay, Condition 2 is okay too,
But, coming to condition 3, (vpn provider detail.php), a mess is happening.. the browser shows url correctly, but the page content shown are of not vpn provider.php. rather, the contents are being displayed of condition one (current offers.php) . I can't understand that why this is happening there. Note that URl is displayed in browser as it should be, but the contents of the page are of current_offers.php (redirecting to it, but not showing the the contents)
Can somebody Guide me please? and tell me what is the problem with my code? or why this is happening to me?
thanks..
Upvotes: 0
Views: 72
Reputation: 10219
It's a question of order.
Hide-My-Ass-1009-details.html doesn't pass the 1st condition, but pass the 2nd one and with [L] - which means Last - it goes for this one.
A fast solution should be
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)-(.*)-offers.html$ current-offers.php?id=$2 [L]
RewriteRule ^(.*)-(.*)-details.html$ vpn-provider-detail.php?id=$2 [L]
RewriteRule ^(.*)-(.*).html$ vpn-offer-detail.php?id=$2 [L]
Upvotes: 1