我有以下重写:
RewriteRule ^first-test-page/?$ testing.php?idPage=1 [NC,L]
如果他访问domain.com/testing.php?idPage=1,如何将用户重定向到domain.com/first-test-page/?
谢谢!
答案 0 :(得分:2)
你需要两个规则。这应该适合你。试一试。
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /+testing\.php\?idPage=1
RewriteRule ^ /first-test-page? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^first-test-page/?$ /testing.php?idPage=1 [NC,L]