Adding www to a url: Difference between revisions
From Joomla! Documentation
No edit summary |
No edit summary |
||
| (9 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
== How | <noinclude><languages /></noinclude> | ||
<translate> | |||
== How Do I Get ''www'' as a Prefix in All My Joomla! Sites? == <!--T:1--> | |||
</translate> | |||
Add the following to your htaccess file | <translate><!--T:2--> | ||
< | Add the following to your ''.htaccess'' file:</translate> | ||
<syntaxhighlight lang="Apache"> | |||
RewriteEngine On | |||
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ | |||
RewriteRule (.*) http://www.example.com/$1 [R=301,L] | |||
</syntaxhighlight> | |||
<translate><!--T:3--> | |||
A more complete solution fixing several other canonicalisation issues at the same time:</translate> | |||
<syntaxhighlight lang="Apache"> | |||
RewriteEngine On | RewriteEngine On | ||
RewriteCond %{ | # | ||
RewriteRule ^(.*) | 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] | |||
</syntaxhighlight> | |||
[[Category:FAQ]] | <noinclude> | ||
[[Category:: | [[Category:FAQ{{#translation:}}]] | ||
[[Category:Installation{{#translation:}}]] | |||
[[Category:Server configurations{{#translation:}}]] | |||
</noinclude> | |||
Latest revision as of 04:23, 19 May 2024
How Do I Get www as a Prefix in All My Joomla! Sites?
Add the following to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
A more complete solution fixing several other canonicalisation issues at the same time:
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]