简体   繁体   English

wordpress 上的 HTAccess 文件未正确重定向

[英]HTAccess file on wordpress is not redirecting correctly

I have this in my wordpress htaccess... trying to redirect tp https, and from our .ca to .net domain.我在我的 wordpress htaccess 中有这个......试图重定向 tp https,并从我们的 .ca 到 .net 域。 Not working :(. I am repeating the bottom lines for all of my pages, yet it goes to 401不工作:(。我正在重复我所有页面的底线,但它转到 401


RewriteOptions inherit

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mywebsite\.ca$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mywebsite\.ca$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ "http\:\/\/mywebsite\.net\/$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ "http\:\/\/mywebsite\.net\/$1" [R=301,L]


redirect 301 /product-category/concentrates/ http://www.mywebsite.net/product-category/concentrates/

By the sounds of it, the .ca and .net domains currently resolve to different vhosts.听上去, .ca.net域目前解析为不同的虚拟主机。 In which case all you need is the following in the root .htaccess file on the .ca domain:在这种情况下,您只需要.ca域上的根.htaccess文件中的以下内容:

Redirect 302 / https://www.example.net/

...and delete everything else! ...并删除所有其他内容! You don't need any of your existing (100s of) directives - they all repeat the same thing anyway!?您不需要任何现有的(100 条)指令 - 无论如何,它们都在重复相同的事情!?

The Redirect directive is prefix-matching, so it redirects /<anything> (on the .ca domain) to https://www.example.net/<anything> . Redirect指令是前缀匹配的,因此它将/<anything> (在.ca域上)重定向到https://www.example.net/<anything>

 RewriteOptions inherit

Where did this come from?这个是从哪里来的? If you simply copy/pasted it from somewhere else then delete it!如果您只是从其他地方复制/粘贴它,则将其删除!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM