2015-02-09 76 views

回答

0

我們無法編輯Wordpress源代碼重定向,因爲它將在未來的更新中被打破。我們無法將所有請求轉發到該請求的www版本,因爲這會破壞所有子域名。

我解決了這個問題,對根.htaccess文件進行了一些編輯。

# This is probably how your file starts already 
RewriteEngine On 
RewriteBase/

# Then you add a condition: if the host starts with example.com 
RewriteCond %{HTTP_HOST} ^example.com.*$ 
# And add a rule: redirect that url to the same url just with prepended with www 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

# Here the file continues with other stuff from WP 
RewriteRule ^index\.php$ - [L] 
相關問題