Mod Rewrite Htaccess for fake subdirectories and directory

I'm trying to create fake directories to redirect certain options to certain subdirectories as such: From: www.example.com/sys/signup To: www.example.com/system/ext.php?t=signup

+3


source to share


1 answer


You need to redirect the browser from the URL with the query string to the one that is missing, then you need to internally rewrite the URL back into the query string:



RewriteEngine On

# redirect the browser to clean URL
RewriteCond %{THE_REQUEST} \ /+system/ext\.php\?t=([^&]+)
RewriteRule ^ /sys/%1? [L,R]

# internally rewrite back to the query string
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^sys/(.*)$ /system/ext.php?t=$1 [L,QSA]

      

+1


source







All Articles