网站最近将网址从mywebsite.com/cat1
更改为mywebsite.com/cat1/
(请注意网址末尾的斜杠)。
为了更新搜索引擎,我想301将旧网址重定向到新网址。
我能够对不包含变量的网址进行重定向,但是我无法使其适用于包含参数的网址。
Options +FollowSymlinks -MultiViews
RewriteEngine On
# Force Trailing Slash
RewriteCond %{REQUEST_URI} /profiles/?$ [NC]
RewriteRule ^[^/]+$ %{REQUEST_URI}/ [L,R=301]
RewriteCond %{REQUEST_URI} /tags/?$ [NC]
RewriteRule ^[^/]+$ %{REQUEST_URI}/ [L,R=301]
# Orginal URL Rewrite
RewriteCond %{REQUEST_URI} /profiles/?$ [NC]
RewriteRule . models.php [L]
RewriteCond %{REQUEST_URI} /tags/hash-([a-z\-A-Z]+)/?$ [NC]
RewriteRule . ?tag=%1 [L,QSA]
RewriteCond %{REQUEST_URI} /([a-z\-A-Z]+)-profile/?$ [NC]
RewriteRule . ?model=%1 [L,QSA]
RewriteCond %{REQUEST_URI} /([a-z\-A-Z]+)-profile/([a-z\-A-Z]+)/?$ [NC]
RewriteRule . m.php?model_url=%1&media_url=%2 [L,QSA]
RewriteCond %{REQUEST_URI} /tags/?$ [NC]
RewriteRule . tags.php [L]
任何帮助?