Urgently need help with a strange .htaccess file

Discussion in 'Search Engine Optimization' started by LawnchairLarry, Jul 21, 2008.

  1. #1
    I'm working on a multilingual website and have trouble setting up the .htaccess file properly. Although there is a .htaccess file present, it hasn't been optimised. The existing file doesn't have the code to overcome the canonicalisation issue and it creates search-engine unfriendly URLs. I fiddled around a bit, but had no luck so far and I had to restore the old .htaccess file. :mad:
    The first thing I would like to do is to permanently redirect URLs to the case-insensitive www-version of the website. I found the following code, but it did not work and I have no idea why not:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^domain\.tld$ [NC]
    RewriteRule (.*) http://www.domain.tld/$1 [R=301,NC,L]
    Code (markup):
    And, no, I haven't forgotten to change domain.tld to my domain name. :p It says “Options +FollowSymlinks <line-break> RewriteEngine on” earlier in the code. Does that cause the problem?
    I would also like to redirect all traffic from the domain to the English homepage, which I would like to be named /en/index.html. There is a strange code present, which turns each PHP-file into an HTML-file with a language extension, like this:

    RewriteRule ^(.*)-en\.html$ $1.php?lang=en&%{QUERY_STRING} [L]
    Code (markup):
    How do I tackle this problem?
    Your help is greatly appreciated! :)
     
    LawnchairLarry, Jul 21, 2008 IP