WordPress重定向错误
问题描述:
I\'m currently using WordPress 4.8 with permalink structure of https://www.example.com/%category%/%postname%/. I also use Redirection plugin. After awhile, I decided to move my wordpress installation from Root to Subdirectory using this tutorial from official wordpress.org. I followed exactly like first method. It works but from time to time I receive a lot of 404 error log in Redirection plugin log and Google Search Console log.
I created subdirectory for wordpress using same name with domain name. Assume my domain is https://www.example.com. I created subdirectory name of www.example.com. Reason because I have multiple addon domains which I installed wordpress in similar way. Only this main domain have problem.
PROBLEM:
I often receive 404 errors log in Redirection plugin log and Google Search Console. Assume I have a page of overflow then my URL error look like this https://www.example.com/www.example.com/category/overflow/ instead of https://www.example.com/category/overflow/ and this is happened everyday on many URL\'s even newer posts. With exception of my index.php where my https://www.example.com/www.example.com/index.php always redirect to https://www.example.com/ without any problem and no error logs.
.HTACCESS on Root
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/www.example.com/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/[0-9]+\\..+\\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\\.txt(?:\\ Comodo\\ DCV)?$ RewriteRule ^(.*)$ /www.example.com/$1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/[0-9]+\\..+\\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\\.txt(?:\\ Comodo\\ DCV)?$ RewriteRule ^(/)?$ www.example.com/index.php [L] </IfModule> |
.HTACCESS on Subdirectory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] </IfModule> # END HTTPS # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> |
QUESTION:
How do I add a wildcard redirects which will redirect anything matching condition www.example.com/www.example.com to www.example.com
For example:
- https://www.example.com/www.example.com/pageA/ to https://www.example.com/pageA/
- https://www.example.com/www.example.com/Category1/pageB/ to https://www.example.com/Category1/pageB/
- https://www.example.com/www.example.com/Category2/pageC/ to https://www.example.com/Category2/pageC/ and so on.
I\'ll be honest. I do know how to redirect oldPage to newPage but seems this is out of my knowledge. I tried many tutorial on google and redirect generator etc but still I receive 404 error logs of that kind. Please help me. Thank in advance.
网友观点:
You can try this plugin 301 redirect. it is useful to redirection old URL to new URL
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » WordPress重定向错误