Thomas Eschemann
Thomas Eschemann

Reputation: 995

Subdomain url rewriting using htaccess on codeigniter

I know this has been asked several times on here, but somehow I can't get any of the code I find to work. My problem is the following.

My url structure looks like this :

http://www.domain.com/algerie/contact

http://www.domain.com/tunisie/demande_devis

http://www.domain.com/tunisie/contact

I would like the url to look like this :

http://www.algerie.domain.com/contact

http://www.tunisie.domain.com/demande_devis

http://www.tunisie.domain.com/contact

I was able to make this work but only using redirections [R], but, I don't what any [R] redirections. Any idea on how to make this work ?

Upvotes: 0

Views: 1726

Answers (1)

M Khalid Junaid
M Khalid Junaid

Reputation: 64476

How about this rewrite the url

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/%1/$1 [L,NC,QSA]

Upvotes: 2

Related Questions