我如何才能使以下网址正常工作(将我重定向到'漂亮'网址)?
访问以下链接:
pictures.php?genre=all&sortby=popularity
访问的重写部分(例如localhost / mydomain / pictures / all / popular)正在运行,但是唯一无法工作的一方是,每当我访问上面的示例时,它都会将我重定向到它。
我目前的代码:
RewriteEngine on
RewriteCond %{THE_REQUEST} /pictures\.php[?\s] [NC]
RewriteRule ^pictures\.php?genre=([a-zA-Z]+)&sortby=([a-zA-Z]+)$ /mydomain/pictures/$1/$2 [NC,R=302,L,NE]
帮助会被暗示!
答案 0 :(得分:0)
试试这个:
RewriteEngine On
RewriteCond %{THE_REQUEST} /pictures\.php\?genre=([^&]+)&sortby=([^&\s]+) [NC]
RewriteRule ^pictures.php$ /pictures/%1/%2? [NE,NC,R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^pictures/([^/]+)/([^/]+)/?$ /pictures.php?genre=$2&sortby=$3 [QSA,L,NC]