How to redirect using .htaccess

Discussion in 'Programming' started by WizardRSS, Jul 30, 2010.

  1. #1
    I am not exactly sure if .htaccess is something considered html or if its coding is its own type so I just decided to go ahead and post it here. If the topic should be somewhere else, feel free to move it

    I am trying to make my website redirect to Google translate in a certain way but it doesn't seem to be working. Could someone tell me if this is an issue with how HostGator has their servers setup or if it just my coding.

    I want http://www.idevlancer.com/es to redirect to http://translate.google.com.vn/trans...devlancer.com/ which is that page translated into Spanish obviously. However, whenever I go to that link in my browser, it is actually forwarding me to that page. But, I am wanting it to keep my on idevlancer.com instead.

    That way people can just go to URL's like this for example (and see them like this):
    http://www.idevlancer.com/es/index.php
    http://www.idevlancer.com/es/test1.php
    http://www.idevlancer.com/es/test2.php
    http://www.idevlancer.com/es/test3.php
    http://www.idevlancer.com/es/test4.php

    Here is the code that is being used in .htaccess for what it is doing right now:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^idevlancer.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.idevlancer.com$
    RewriteRule ^es\/?(.*)$ "http\:\/\/translate\.google\.com\/translate\?hl\=es\&sl\=en\&u\=http\:\/\/www\.idevlancer\.com\/$1" [R=301,L]
    Code (markup):
    If anyone can be of any help that would be wonderful!
     
    WizardRSS, Jul 30, 2010 IP
  2. spc

    spc Well-Known Member

    Messages:
    136
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    125
    #2
    You can use iframe instead to serve the purpose of displaying the idevlancer.com as URL.
     
    spc, Jul 30, 2010 IP