Rewriting a sub directory problem

Using a single web hosting account to host multiple sites

Rewriting a sub directory problem

Postby clive » Thu Oct 01, 2009 8:58 pm

I have a problem trying to redirect a sub-domain to my main domain.

my redirect is as follows:
# ------------------------------------------------------------------------
# points all subdomain requests to the main domain file structure
# and tags the language indicator query tag to the end
# ------------------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^sv.mysite.com$ [NC]
RewriteRule ^sv/(.*)$ http://www.mysite.com/$1?lang=sv

Problem is when the URL is just //http:sv.mysite.com
I get: //http:www.mysite.com
without the ?lang=sv tagged on

It works ok if there is something after the mysite.com to be picked up for the $1 parameter but if there is nothing it seems to ignore the ?lang=sv

Any help would be appreciated....
clive
 
Posts: 5
Joined: Thu Oct 01, 2009 8:54 pm
Location: France

Postby richardk » Fri Oct 02, 2009 4:09 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^sv\.example\.com$ [NC]
RewriteRule ^sv(/(.*))?$ http://www.exmaple.com/$2?lang=sv [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 30 guests

cron