【发布时间】:2020-02-17 21:14:36
【问题描述】:
我在.htaccess 文件中添加了额外的规则。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule !^/articles/(.*)$ https://%{HTTP_HOST}/index.php?name=$1 [L,R=301]
RewriteRule ^(articles/)(.*)$ https://%{HTTP_HOST}/index.php?name=$2 [L,R=301]
</IfModule>
我有两个似乎可行的条件:
http://example.com/this-is-old-url/符合第一个重写规则http://example.com/articles/this-is-old-url/符合第二条规则
但问题是,添加这些规则后,我的网站开始到处进行重定向。例如,我无法访问更改为 https://example.com/index.php?name= 的域 https://example.com。我所有的网站链接都断开了。
我做错了什么?
【问题讨论】:
-
只需为您的
this-is-old-url制定特定规则。所有非atricles的 URL 也都匹配第一条规则。
标签: php wordpress .htaccess redirect