Roger Wayne Roger Wayne - 6 months ago 58
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


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]