将旧网址重写为漂亮的网址,然后使用 .htaccess 将这些网址重定向到新网址

问题描述 投票:0回答:0

第一次尝试做这样的事情,所以,我需要将旧网址重写为新网址,然后使用 301 重定向

旧网址

.htaccess

RewriteRule ^1/(.*)/(.*).html /index.php?t=2&p=$2&c=$1 [L,QSA,NC]

新网址

.htaccess

RewriteRule ^c/(.*)/1/$ /index.php?o=2&p=1&c=$1 [L,QSA,NC]

我试过这个,到目前为止,我没有任何运气

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^1/(.*)/(.*).html /index.php?o=2&p=$1&c=$1 [L,QSA,NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?o=(\d+)&c=([^\s]+)&p=(\d+) [NC]
RewriteRule ^ c/%1/%2/%3/? [R=301,L]
.htaccess redirect mod-rewrite
© www.soinside.com 2019 - 2024. All rights reserved.