Forum Moderators: phranque

Message Too Old, No Replies

.htaccess Rewrite Virtual Subdomain and Sub directories

.htaccess Rewrite Virtual Subdomain and Sub directories

         

arunkumar nice

7:02 am on May 19, 2009 (gmt 0)

10+ Year Member



Dear All,

By using .htaccess is it possible to rewrite both the following urls .

1) [test.xyz.com...] ==>
[test.xyz.com...]

2)http://www.test.xyz.com/dir/index.php?name=arun ==>
[test.xyz.com...]

Note: In the above urls the word "test" and "dir" is a variable one not static :)

Looking for a solution from the experts

jdMorgan

6:01 pm on May 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, use a RewriteCond to test HTTP_HOST and QUERY_STRING, and append the subdomains (test or dir) to the query string as the "subomain=" name/value pair if it is not already present.

While we can 'help' you with your code here, we cannot write it for you. There are simply too many 'askers' and not enough 'helpers' here to support that mode of operation (Please see our Forum Charter). So, using the above tips, please try coding and testing this, and post your best-effort code and test results.

Thanks,
Jim