Roger Wayne Roger Wayne - 1 year ago 177
PHP Question

Convert url slash to parameter

I have to convert url like this


to this


I have CMS on same server and i dont wan't to mess up it's htaccess so this should work only on that specific directory (long).

Tried this but it wont work:
Rewriting a URL to a PHP parameter from inside a subdirectory

Answer Source

Inside long/.htaccess you can use this rule:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ long.php?l=$1 [L,QSA]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download