我目前在.htaccess中有这个重写规则:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index/([^/]*)/?$ /index.php?user=$1 [L]
RewriteRule ^index/([^/]*)/([^/]*)$ /index.php?user=$1&sort=$2 [L]
我想将上述/index
重定向到/home
,其中还需要考虑参数。我怎么能这样做?
答案 0 :(得分:0)
尝试将规则更改为:
RewriteRule ^index/(.*)$ /home/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^home/([^/]*)/?$ /index.php?user=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^home/([^/]*)/([^/]*)$ /index.php?user=$1&sort=$2 [L]