I thought this would be simple...

Discussion in 'Apache' started by sagetips, Nov 17, 2007.

  1. #1
    I have a Wordpress blog that has posts in English and dynamic Spanish translations that via permalink have an /es/ directory extension:

    English: http://site.com/

    Spanish: http://site.com/es/

    Is there a way to use .htaccess to always redirect to the /es/ pages? In other words, when someone typed in www.site.com they go to www.site.com/es/.

    The variations I've tried have all created endless loops.

    Thanks
     
    sagetips, Nov 17, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    This? Although this prevent access to the English version!

    RewriteEngine On
    RewriteBase /
    RewriteRule !^es/ es%{REQUEST_URI} [R=301,L]

    I think this is best handled in a server side script.
     
    krt, Nov 17, 2007 IP
  3. sagetips

    sagetips Peon

    Messages:
    239
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply, krt.

    I tried your suggestion, but still get "endless loop" error. :confused:
     
    sagetips, Nov 19, 2007 IP
  4. hostingonweb

    hostingonweb Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    RedirectMatch permanent ^(slash)index.php$ http(colon)(slash)(slash)site.com(slash)es

    Replace (slash) with /

    Where index.php is the index file outside your es directory. It can be anything index.htm , index.html etc..
     
    hostingonweb, Nov 19, 2007 IP