我正在尝试重定向
example.com/ slide?page = 4 到example.com/ slide / issue43?page = 4
但它不会影响其他URL,例如example.com/ slide / issue57?page = 4
我真的很困惑,这些正则表达式太奇怪了。这是我想出的重写器,
This is not working
RewriteRule ^slide?page(.*)$ http://example.com/slide/issue43?page=$1 [L,R=301]
我需要专门定位“ slide?page = X ”,并将其重定向或指向“ slide / issue43?page = X ”
最佳答案
这应该为您工作:
RewriteCond %{REQUEST_URI} ^/slide$
RewriteCond %{QUERY_STRING} ^page=(.*)$
RewriteRule ^(.*) /slide/issue57?page=%1 [R=301,L]
关于.htaccess - 将特定的URL重写到其他目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10251535/