【发布时间】:2017-01-03 17:20:33
【问题描述】:
为了让.htaccess 允许fa 图标可见,我做了一些更改。
以前www.mywebsite.com fa 图标不可见。我在.htaccess 中添加了几行代码,它开始工作了。
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
Header set Access-Control-Allow-Origin "http://www.mywebsite.com"
</FilesMatch>
</IfModule>
<IfModule mod_mime.c>
# Web fonts
AddType application/font-woff woff
AddType application/vnd.ms-fontobject eot
# Browsers usually ignore the font MIME types and sniff the content,
# however, Chrome shows a warning if other MIME types are used for the
# following fonts.
AddType application/x-font-ttf ttc ttf
AddType font/opentype otf
# Make SVGZ fonts work on iPad:
# https://twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
</IfModule>
现在,mywebsite.com(没有 www)不起作用。所以我加了
Header set Access-Control-Allow-Origin "http://mywebsite.com"
这样
标头集 Access-Control-Allow-Origin "http://www.mywebsite.com" 标头集 Access-Control-Allow-Origin "http://mywebsite.com"
然后mywebsite.com 开始工作了。现在www.mywebsite.com 已经停止工作了。
我在我的网站上使用wordpress。我错过了什么?
编辑 我尝试根据各种论坛的建议添加 3 行,但最终却得到 500 Internal error。
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
我错过了什么,我需要将此代码放在某个 <ifModule> 块中吗?
【问题讨论】:
标签: wordpress apache .htaccess mod-rewrite url-rewriting