Forum Moderators: coopster & phranque

Message Too Old, No Replies

need .htaccess code

special redirection using wildcard dns

         

adrianmurphy

4:18 pm on Apr 15, 2002 (gmt 0)



Hi,
I use wildcard dns to point all requests at the root e.g
whatever.mysite.com goes to root etc.however i'll like to redirect these requests to mysite.com/users/sites/whatever
so what do i put in the .htacces file bearing in mind that i want requests just for mysite.com to be left alone.
thanx
adrian

paynt

2:12 am on Apr 17, 2002 (gmt 0)



Hi adrianmurphy and welcome to Webmaster World.

I always love these questions and hope a little bump will remind someone with an answer to respond.

Darn if your first post wasn't on US tax day. That alone could be why it was missed. Hang tight and lets see what pops up.

bird

2:39 am on Apr 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I recently did the same thing for testing a new design on a site, without having to establish a full test domain:

RewriteCond %{REQUEST_URI} !^/users/sites/whatever
RewriteCond %{HTTP_HOST} ^whatever\.mysite\.com$ [NC]
RewriteRule ^(.*)$ /users/sites/whatever/$1 [L]

The first condition makes sure that the internal subrequest generated by the rewrite doesn't get processed by the same rule again (which would result in an infinite loop).
The second condition checks for the subdomain (case insensitive with the [NC] flag).
And finally, the fairly obious rule.