htaccess在RewriteRule之后重定向

时间:2018-07-27 08:04:09

标签: apache .htaccess mod-rewrite

我的.htaccess这样写:

RewriteEngine On

RewriteRule  ^([0-9]+)/([a-zA-Z0-9-]+)/$ /?p=$1

并将诸如https://mysitedotcom/162/title-of-my-post-id162/之类的地址解析为https://www.mysitedotcom/?p=162

现在我有一个公共URL列表,可以重定向到其他地址,例如:

https://mysitedotcom/200/title-of-post-with-id-200/重定向到> https://mysitedoccom/100/title-of-my-post-with-id-100/

https://mysitedotcom/201/title-of-post-with-id-201/重定向到> https://mysitedotcom/158/title-of-my-post-with-id-158/

以此类推。

我尝试:

Redirect /201/title-of-post-with-id-201/ /158/title-of-my-post-with-id-158/

但是效果不好,因为在浏览器地址栏中,我看到了https://mysitedotcom/158/title-of-my-post-with-id-158/?p=201,所以我不想看到?p = 201

0 个答案:

没有答案