Difference between revisions of "Adding www to a url/zh-hans"

From Joomla! Documentation

(Blanked the page)
 
Line 28: Line 28:
  
 
<noinclude>
 
<noinclude>
 
+
[[Category:FAQ]]
 +
[[Category:Installation]]
 +
[[Category:Server configurations]]
 
</noinclude>
 
</noinclude>

Latest revision as of 09:13, 26 April 2016

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎português do Brasil • ‎فارسی • ‎हिन्दी • ‎অসমীয়া • ‎বাংলা • ‎中文(台灣)‎ • ‎中文(简体)‎

怎样才能给我的Joomla网站上添加上“www”前缀呢?

添加如下内容到你的.htaccess文件中:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

同时针对于纠正网址指向错误的较完整的解决方案:

RewriteEngine On
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]