How do you retrieve the current domain URL?

Popular automatic website translation tool

How do you retrieve the current domain URL?

Postby popular » Sat Feb 23, 2013 6:45 pm

Hello,

I am having a problem in that I want to redirect some of my pages to their https equivalent based on what domain they are on. So I want all pages involving shop.cart to be redirected say from http://ja.mysite.com/blahblah?shop.cart to https://ja.mysite.com/blahblah?shop.cart but when I try and do this via htaccess or PHP I get the result that the domain is always www. even when it is ja. or fr. etc. I guess this must be down to the CDN but there must be a way of recognising which domain I am currently in? Thank you for your time.
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby Edvard » Sat Feb 23, 2013 6:49 pm

Hi,

You can use %{HTTP:X-GT-Lang} variable to know the selected language in .htaccess file.
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: How do you retrieve the current domain URL?

Postby popular » Sat Feb 23, 2013 6:57 pm

Hi Edvard, thank you for the reply. I am finding it hard to understand. Could you please show me what I should put in the htaccess to say redirect:

http://ja.popularseeds.com/contact-us to https://ja.popularseeds.com/contact-us

and for that to be active only for the ja domain?
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby Edvard » Sat Feb 23, 2013 7:10 pm

It can be something like this:

RewriteCond %{HTTP:X-GT-Lang} ^ja$ # if language is ja and
RewriteCond %{HTTPS} ^off$ # if protocol is not https
RewriteRule ^contact-us$ https://ja.domain.com/contact-us [R=301,L]

I'm not sure, but it should be possible to use %{HTTP:X-GT-Lang} in the RewriteRule, something like this

RewriteCond %{HTTP:X-GT-Lang} !^$ # if there is selected language and
RewriteCond %{HTTPS} ^off$ # if the protocol is not https
RewriteRule ^contact-us$ https://%{HTTP:X-GT-Lang}.domain.com/contact-us [R=301,L]

It should be also possible to do this:
RewriteCond %{HTTP:X-GT-Lang} ^(.+)$ # if there is selected language and
RewriteCond %{HTTPS} ^off$ # if the protocol is not https
RewriteRule ^contact-us$ https://%1.domain.com/contact-us [R=301,L]
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: How do you retrieve the current domain URL?

Postby popular » Sat Feb 23, 2013 7:15 pm

Hi Edvard,

I'm afraid I'm getting 500 server error with both versions. Is there a better or working way in which I can redirect certain URLs to HTTPS and keep the domain so http://ja.popularseeds.com will redirect to https://ja.popularseeds.com?
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby popular » Sat Feb 23, 2013 7:18 pm

Hello,

The third version is close and redirects from http://ja.popularseeds.com to https://.popularseeds.com/contact-us so it is missing the domain but it is nearly there. Do you know how I can get the domain in there? Thank you for your time.
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby Edvard » Sat Feb 23, 2013 7:19 pm

I'm not sure about your server specifics and cannot tell exactly how it should be, you will need to play with it little more, but you can do the redirect easily in PHP, you can check the selected language using $_SERVER['HTTP_X_GT_LANG'] variable and make the appropriate redirect using

header("Location: $redirect_url");
exit;
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: How do you retrieve the current domain URL?

Postby popular » Sat Feb 23, 2013 7:24 pm

Hi Edvard, thank you for the help. Is there any way I can hire you for an hour or 2 to complete the necessary redirects?
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby Edvard » Sat Feb 23, 2013 7:43 pm

You may contact 2glux.com to do the configuration for you.

Thanks!
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: How do you retrieve the current domain URL?

Postby popular » Sun Feb 24, 2013 1:04 am

Hi Edvard, thank you for that. I will have the SSL wildcard cert installed and then try the redirection stuff again. I will send the details through in the contact form.

Regards,
Anthony.
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby Edvard » Sun Feb 24, 2013 8:32 pm

Hi,

Please send us the file you got from your provider, so we can install it for you on our side.

Thanks!
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia


Re: How do you retrieve the current domain URL?

Postby Yana » Sun Feb 24, 2013 11:41 pm

Hi,
Can you please send an email with SSL certificate as an attachment?
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: 4135
Joined: Thu Jan 12, 2012 6:21 pm

Re: How do you retrieve the current domain URL?

Postby popular » Mon Feb 25, 2013 2:01 am

Hello, I have sent SSL info inside a text file to you. Please let me know if that is insufficient.
popular
 
Posts: 26
Joined: Mon Feb 18, 2013 12:15 am

Re: How do you retrieve the current domain URL?

Postby Yana » Mon Feb 25, 2013 2:07 am

Hi,
Thank you!
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: 4135
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
cron