一共有两种链接需要301
https://www.1.com/product/view28043.html
https://www.1.com/product/28043.html
第二种:
https://www.1.com/news/txtlist_i466v.html
https://www.1.com/news/466.html
网站是apache的 .htaccess
一共有两种链接需要301
https://www.1.com/product/view28043.html
https://www.1.com/product/28043.html
第二种:
https://www.1.com/news/txtlist_i466v.html
https://www.1.com/news/466.html
网站是apache的 .htaccess
让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言要将这两种链接进行301重定向,可以通过在网站的根目录下创建一个名为“.htaccess”的文件,并在其中添加以下代码来实现:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/product/view28043.html$
RewriteRule ^(.*)$ https://www.1.com/product/28043.html [R=301,L]
RewriteCond %{REQUEST_URI} ^/news/txtlist_i466v.html$
RewriteRule ^(.*)$ https://www.1.com/news/466.html [R=301,L]
以上代码中,通过RewriteEngine指令开启重写引擎,然后分别设置RewriteCond指令来匹配需要重定向的原始链接,再使用RewriteRule指令将原始链接重定向到新链接,并使用[R=301,L]参数来指定301重定向和停止后续规则的执行。 通过以上设置,当访问原始链接时,将会被301永久重定向到新链接,实现了链接的规范化处理。 对于网站是Apache的情况,以上方法适用。请确保在操作前备份现有的.htaccess文件,以防操作失误造成问题。