追加到WWW使用URL htaccess的 [英] Append www into URL using htaccess
问题描述
我有一个字preSS的网站,如果我通过域的全名访问它工作正常,例如 www.example.com
。但是如果我尝试访问它无需键入 WWW
例如 example.com
,我得到以下错误:
I have a WordPress site which works fine if I access it through the full name of the domain, example www.example.com
. However if I try to access it without typing the www
e.g example.com
, I get the following error:
Origin http://example.com is not allowed by Access-Control-Allow-Origin.
唯一的解决办法我能想到的是追加/重写任何请求 example.com
到 www.example.com
。我怎样才能做到这一点与的.htaccess
?
The only solution I can think of is to append / rewrite any request to example.com
to www.example.com
. How can I achieve this with .htaccess
?
推荐答案
对于那些谁遇到这样的使用Word preSS。我把它固定在安装此插件 https://github.com/jacopotarantino /字preSS-跨域-插件并添加网站到允许的域。
For those who encountered this with WordPress. I got it fixed by installing this plugin https://github.com/jacopotarantino/WordPress-Cross-Domain-Plugin and add the site into "Allowed Domains".
这篇关于追加到WWW使用URL htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!