jeudi 24 août 2017

Redirect www to non-www with site installed in subfolder

I have a Joomla website at site.com.au installed in public_html/subfolder

The redirect works properly to remove the /subfolder from the url, but I CANNOT get it to work with www redirecting to non-www. Going to site.com.au works, going www.site.com.au times out. I've called the web host (Crazy Domains) and the guy spent 20 minutes trying to figure it out and couldn't.

Current htaccess looks like this:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\.)?site\.com\.au$ [NC]
RewriteCond %{REQUEST_URI} !/subfolder/
RewriteRule (.*) /subfolder/$1 [L]

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

I have also tried

RewriteEngine on

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} subfolder/
RewriteRule ^subfolder/(.*) http://site.com.au/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !subfolder/
RewriteRule ^(.*)$ /subfolder/$1 [L]




Aucun commentaire:

Enregistrer un commentaire