我正在尝试创建虚假目录以将特定参数重定向到特定子目录,如下所示: 来自:www.example.com/sys/signup 要访问:www.example.com/system/ext.php?t = signup
答案 0 :(得分:1)
您需要将浏览器从带有查询字符串的URL重定向到没有的浏览器,然后您需要在内部将URL 返回重写为带有查询字符串的URL:
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]