Free advertising for your Joomla business
× The best place to ask questions about problems that you might be having with Joomla is the forum at JoomlaOz. We may be able to help you if you post your question here.

Solved Non www to www .htaccess

  • Laurie
  • Laurie's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 5 months ago #100 by Laurie
Non www to www .htaccess was created by Laurie
G'day there!

I need to do a redirect in the .htaccess file from the non www version to www version.

On the net, I've found several slightly different versions of the required code and all are slightly different to what I've used before.

Will this work?
RewriteCond %{HTTP_HOST} ^site.com [NC] 
RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301]

I understand that NC means No Case (non case sensitive) and L means Limit (the redirect stops here). R=301 would be the 301 redirect.

Thanks,
Laurie.

Please Log in or Create an account to join the conversation.

More
4 years 5 months ago #101 by sozzled
Replied by sozzled on topic Non www to www .htaccess
I wouldn't do it quite like that. To redirect requests from site.com to www.site.com , add the rule as you see it to your .htaccess file.
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
## End - Custom redirects

Read my blog and
File Attachment:

Please Log in or Create an account to join the conversation.

  • Laurie
  • Laurie's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 5 months ago #104 by Laurie
Replied by Laurie on topic Non www to www .htaccess
Thanks for that Sozzled

Please Log in or Create an account to join the conversation.

Time to create page: 0.269 seconds