gpt4 book ai didi

regex - 301 将旧网址重定向到移动网站中的新网址

转载 作者:行者123 更新时间:2023-12-05 07:51:11 24 4
gpt4 key购买 nike

我需要将旧网址重定向到位于 http://www.domain.com/mobile/ 的移动版网站中的 seoed 网址,并且有自己的 .htaccess 文件具有以下重写规则:

RewriteRule ^browse-(.*)-videos.html$ category.php?cat=$1

RewriteRule ^browse-(.*)-videos-([0-9]+)-(.*).html$ category.php?cat=$1&page=$2&sortby=$3

我如何 301 将旧网址重定向到新网址?

最佳答案

这样说:

RewriteEngine On
RewriteBase /mobile/

RewriteCond %{THE_REQUEST} /category\.php\?cat=([^\s&]+)\s [NC]
RewriteRule ^ browse-%1-videos.html? [R=302,L,NE]

RewriteRule ^browse-(.*)-videos.html$ category.php?cat=$1 [L,QSA,NC]

RewriteRule ^browse-(.*)-videos-([0-9]+)-(.*).html$ category.php?cat=$1&page=$2&sortby=$3 [L,QSA,NC]

关于regex - 301 将旧网址重定向到移动网站中的新网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35301181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com