[英]www redirection not working on Wordpress on Openshift
I've setup a wordpress application on Openshift and I added 2 aliases (www.mysite.ma - mysite.ma). 我在Openshift上安装了一个wordpress应用程序,并添加了2个别名(www.mysite.ma-mysite.ma)。 I followed the instructions to create a CNAME record, and I did so using CloudFlare.
我按照说明创建了CNAME记录,并使用CloudFlare做到了。 I've also changed my wordpress settings for the new URL.
我还更改了新URL的wordpress设置。
My DNS Records on CloudFlare : 我在CloudFlare上的DNS记录:
www -> myapp.rhcloud.com
@ -> myapp.rhcloud.com
When I visit www.mysite.ma , I can see my normal Wordpress site. 当我访问www.mysite.ma时 ,我可以看到我的常规Wordpress网站。 But when I go to mysite.ma , it returns a 404 error with a changed link ( https://mysite.ma/app )
但是当我转到mysite.ma时 ,它会返回404错误,并带有更改的链接( https://mysite.ma/app )
I tried to modify my .htaccess file to the following : 我试图将.htaccess文件修改为以下内容:
RewriteEngine on
# Uncomment the following lines to force HTTPS
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# WordPress Defaults
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# 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]
RewriteCond %{HTTP_HOST} !www.mysite.ma$ [NC]
RewriteRule ^(.*)$ http://www.mysite.ma/$1 [L,R=301]
</IfModule>
# END WordPress
But nothing changed, even when I do a ping request to www.mysite.ma and myapp.rhcloud.com I get the same IP Adress, not for mysite.ma 但是什么都没有改变,即使我对www.mysite.ma和myapp.rhcloud.com发出ping请求,我也获得了相同的IP地址,而不是mysite.ma
Thanks. 谢谢。
You can try http://wwwizer.com/ service: 您可以尝试http://wwwizer.com/服务:
Point 点
www to yourapp.rhcloud.com
mysite.ma to 174.129.25.170
wwwizer does a 301 redirect from mysite.ma to www.mysite.ma
wwwizer进行301从
mysite.ma to www.mysite.ma
重定向mysite.ma to www.mysite.ma
It's free, you don't have to create an account to use this service. 它是免费的,您无需创建帐户即可使用此服务。
Instead of this; 代替这个;
RewriteCond %{HTTP_HOST} !www.mysite.ma$ [NC]
RewriteRule ^(.*)$ http://www.mysite.ma/$1 [L,R=301]
Try this; 尝试这个;
RewriteCond %{HTTP_HOST} ^mysite.ma [NC]
RewriteRule ^(.*)$ http://www.mysite.ma/$1 [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.