Block GTranslate redirect to WWW

Popular automatic website translation tool

Block GTranslate redirect to WWW

Postby csaocean » Tue Jan 07, 2014 12:47 am

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
csaocean
 
Posts: 7
Joined: Mon Jan 06, 2014 9:06 pm

Re: Block GTranslate redirect to WWW

Postby csaocean » Tue Jan 07, 2014 1:13 am

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"

Code: Select all
RewriteEngine On

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
csaocean
 
Posts: 7
Joined: Mon Jan 06, 2014 9:06 pm

Re: Block GTranslate redirect to WWW

Postby csaocean » Tue Jan 07, 2014 1:15 am

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.
csaocean
 
Posts: 7
Joined: Mon Jan 06, 2014 9:06 pm

Re: Block GTranslate redirect to WWW

Postby csaocean » Tue Jan 07, 2014 5:09 am

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:

Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.(.*)\. [NC]
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L,NC]
csaocean
 
Posts: 7
Joined: Mon Jan 06, 2014 9:06 pm

Re: Block GTranslate redirect to WWW

Postby csaocean » Tue Jan 07, 2014 6:00 pm

I figured it out by grabbing this line from another forum post and adding it to my .htaccess file.

Code: Select all
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):

Code: Select all
RewriteEngine On
RewriteCond %{HTTP:X-GT-Lang} ^$
RewriteCond %{HTTP_HOST} ^YOUR_DOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://www.YOUR_DOMAIN.com/$1 [L,R=301]
csaocean
 
Posts: 7
Joined: Mon Jan 06, 2014 9:06 pm

Re: Block GTranslate redirect to WWW

Postby Yana » Tue Jan 07, 2014 10:36 pm

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/
Regards,

Yana Ghahramanyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Yana
 
Posts: 4134
Joined: Thu Jan 12, 2012 6:21 pm


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux