Block GTranslate redirect to WWW
Jan 6, 2014 8:47 pm by csaocean
Jan 6, 2014 8:47 pm by csaocean
Hello,
We currently have our www redirect off so the enterprise translations work, but we would like it back on for SEO purposes.
How do I properly block your network from the www redirect using the .htaccess file?
Thank you,
John
Re: Block GTranslate redirect to WWW
Jan 6, 2014 9:13 pm by csaocean
Jan 6, 2014 9:13 pm by csaocean
Anyone else looking for this solution. This worked for me, just add the code below to your .htaccess file and if you are using Sh404sef to automatically redirect non-www to www or visa versa be sure to set that variable to "Do Not Enforce"
RewriteEngine On
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Re: Block GTranslate redirect to WWW
Jan 6, 2014 9:15 pm by csaocean
Jan 6, 2014 9:15 pm by csaocean
Sorry, that code does not work. If someone has a solution that would be very helpful. If I figure it out I will post the answer.
Re: Block GTranslate redirect to WWW
Jan 7, 2014 1:09 am by csaocean
Jan 7, 2014 1:09 am by csaocean
Ok, not sure why it not working on any of the language subdomains but this htaccess works fine on my other subdomains like mail.domain.com:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.(.*)\. [NC]
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L,NC]
Re: Block GTranslate redirect to WWW
Jan 7, 2014 2:00 pm by csaocean
Jan 7, 2014 2:00 pm by csaocean
I figured it out by grabbing this line from another forum post and adding it to my .htaccess file.
RewriteCond %{HTTP:X-GT-Lang} ^$
This is what the completed code looks like in case you need it (obviously replace "YOUR_DOMAIN" with your domain):
RewriteEngine On
RewriteCond %{HTTP:X-GT-Lang} ^$
RewriteCond %{HTTP_HOST} ^YOUR_DOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://www.YOUR_DOMAIN.com/$1 [L,R=301]
Re: Block GTranslate redirect to WWW
Jan 7, 2014 6:36 pm by Yana
Jan 7, 2014 6:36 pm by Yana
Hi,
Here are the rules
RewriteCond %{HTTP:X-GT-Lang} ^$
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
You should add them after 'RewriteEngine On' line
You can find the documentation here https://gtranslate.io/docs/
SIMILAR TOPICS
Gtranslate Multisite | Feb 12, 2019 7:27 am | Replies: 1 | Post by: infact_dat |
Gtranslate: Error with number | Feb 20, 2019 1:20 am | Replies: 1 | Post by: infact_dat |
GTranslate 3.7.4, Joomla 3.9.3 - doGTranslate is not defined | Feb 22, 2019 12:34 pm | Replies: 1 | Post by: oase |
Add-on gtranslate no longer works | Feb 2, 2019 6:01 am | Replies: 1 | Post by: DarylDixon |
Instragram and Gtranslate...!!!! | Dec 19, 2018 11:18 am | Replies: 1 | Post by: zackfernandes |