[英]non www to www for both http and https not working
Have searched and applied many of the rewrite rules available but no avail, 搜索并应用了许多可用但无济于事的重写规则,
I am trying 我在尝试
http://website.io/paypal should go http://www.website.io/paypal but it simply goes to www home page http://www.website.io http://website.io/paypal应该转到http://www.website.io/paypal,但是它只是转到www主页http://www.website.io
should be the same for https. 对于https应该相同。 Or at lest non-www redirects to https://www.website.io/paypal is fine, but should carry the page name.
否则,最好将非www重定向到https://www.website.io/paypal ,但应带有页面名称。
after many trial and error versions here is the closest one I have got which isn't working good 经过许多试验和错误的版本后,这是我得到的最接近的版本,效果不好
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# WordPress Defaults
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
UPDATE 更新
It seems nothing wrong with redirection though, www and non www domains were mapped to different ips thus not found on non-www urls. 尽管重定向似乎没有错,但www和非www域被映射到了不同的ip,因此在非www URL上找不到。
Here is your exact working code. 这是您的确切工作代码。 This will redirect you to your desired page perfectly.
这将使您完美地重定向到所需的页面。
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI}paypal [R=301,L]
# WordPress Defaults
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Note: Only this below line has some minor change otherwise you have done great job. 注意:只有下面这行有一些细微的变化,否则您做得很好。
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI}paypal [R=301,L]
Let me know if it solves your issue ? 让我知道是否可以解决您的问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.