繁体   English   中英

清除网址后是否需要301重定向

[英]Do I need a 301 Redirect after clean URL's

我刚刚完成了清理网址的过程

原始脏网址:-http: http://www.michelledaniels.co.uk/photos/index.php?/page/contact-michelle page/contact- http://www.michelledaniels.co.uk/photos/index.php?/page/contact-michelle

新的干净网址:-http: http://www.michelledaniels.co.uk/photos/page/contact-michelle

我现在应该设置301重定向以避免重复的内容问题吗?

非常感谢您的帮助?

是的,您确实需要301从旧URL重定向到新URL,以避免重复的内容。

通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在DOCUMENT_ROOT目录下的.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(photos)/index\.php\?([^\s]+) [NC]
RewriteRule ^ /%1/%2? [R=301,L]

RewriteCond %{QUERY_STRING} ^$ 
RewriteRule ^(photos)/(.+?)/?$ /$1/index.php?$2 [NC,QSA,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM