Stuck in url management

hi guys,

needs your help, I’m using following htaccess code to manage the url’s like /long-url/ point to long-url.php

i.e removing extensions and adding slashes.

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

now, I want to add 1 more thing and it breaks it.

RewriteRule ^/p([0-9]*)\/$ /product.php?id=$1 [L]
it should work as /p123/ to product.php?id=123

any idea where to put this in above code, I have put it top and bottom but not works.

Before the other code. General rule: Order by most specific to most general.



what ? couldn’t get it


Your {anything followed by digits} is more specific than {anything} so it should precede the {anything but / followed by anything} or {anything but /}. Use that order.