.htaccess Htaccess to 301将无结束斜杠重定向到结束斜杠
我有两个域显示相同的信息。我想有一个没有结束在一个斜杠301重定向到一个有 当前重写规则:.htaccess Htaccess to 301将无结束斜杠重定向到结束斜杠,.htaccess,redirect,mod-rewrite,.htaccess,Redirect,Mod Rewrite,我有两个域显示相同的信息。我想有一个没有结束在一个斜杠301重定向到一个有 当前重写规则: RewriteRule ^locations/([a-zA-Z0-9_-]+)/?$ search.php?type=location&slug=$1 [L] 更改您没有的规则并删除?,将尾部斜杠作为一项要求: RewriteRule ^locations/([a-zA-Z0-9_-]+)/$ search.php?type=location&slug=$1 [L] 然后添加以下内
RewriteRule ^locations/([a-zA-Z0-9_-]+)/?$ search.php?type=location&slug=$1 [L]
更改您没有的规则并删除
?
,将尾部斜杠作为一项要求:
RewriteRule ^locations/([a-zA-Z0-9_-]+)/$ search.php?type=location&slug=$1 [L]
然后添加以下内容(之前或之后):
当请求没有尾随斜杠时重定向浏览器。更改您没有的规则并删除要求尾随斜杠的
?
:
RewriteRule ^locations/([a-zA-Z0-9_-]+)/$ search.php?type=location&slug=$1 [L]
然后添加以下内容(之前或之后):
在发出请求时重定向浏览器,但不带尾随斜杠