Rewrite Querystring to SubDomain

Ask your mod_rewrite and Redirection questions here, and get answers!

Rewrite Querystring to SubDomain

Postby tejit2004 » 08 May 2008 10:14

Hello ,

I want to convert example.com/index.html?shop=5
to
shop5.example.com.

Here is the code which i have implemented

Code: Select all
Options +FollowSymLinks
Order deny,allow
RewriteEngine on
RewriteCond %{QUERY_STRING} ^([a-zA-Z0-9]+)\=(.*)
RewriteRule (.*) http:\/\/%1%2\.example.com\/? [R=301,L]


It's working almost all the browsers except IE . can anyone please modify so it can work in IE as well.

Thanks.
tejit2004
 
Posts: 4
Joined: 29 Apr 2008 08:11

Re: Rewrite Querystring to SubDomain

Postby mod_rewrite » 09 May 2008 22:09

tejit2004 wrote:I want to convert example.com/index.html?shop=5
to
shop5.example.com


Try this..

Code: Select all
Options +FollowSymLinks
Order deny,allow
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.+)=(.+)$
RewriteRule ^(.*)$ http://%1%2.example.com/? [R=301,L]


Let me know if it works for you
mod_rewrite
 
Posts: 102
Joined: 30 Oct 2006 19:55

Re: Rewrite Querystring to SubDomain

Postby tejit2004 » 10 May 2008 05:16

Hi Thanks for giving your time .

But it seems it's still not working for me in IE.

It's working in all other browsers.
Thanks...
tejit2004
 
Posts: 4
Joined: 29 Apr 2008 08:11

Re: Rewrite Querystring to SubDomain

Postby mod_rewrite » 11 May 2008 04:10

Thats definately not because of the code above, it can only be from other stuff in your .htaccess file or you need to clear the browser cache in IE. If it still doesn't work you can post your full .htaccess or provide the link so we can see what is going on.
mod_rewrite
 
Posts: 102
Joined: 30 Oct 2006 19:55

Re: Rewrite Querystring to SubDomain

Postby tejit2004 » 12 May 2008 05:27

Ok,
I have removed all the cache , other offline content and temporary files also. it still not works.

Here is the URL

http://tejastrivedi.com/index.html?shop=5
Thanks for taking an interest to solve my problem.
Thanks.
tejit2004
 
Posts: 4
Joined: 29 Apr 2008 08:11


Return to Redirect or Rewrite Questions



Who is online

Users browsing this forum: Acennasnacrah, RombNeore, TypeTride

cron