Forum Moderators: phranque

Message Too Old, No Replies

Help needed- subdomains

         

arun10427

6:21 am on Apr 13, 2010 (gmt 0)

10+ Year Member



Hi,

I have a subdomain named http://arun.example.com and another domain named www.example.com/projects/main.php/. I want my subdomain to always redirect to www.example.com/projects/main.php/. How to do this? Kindly help

[edited by: jdMorgan at 3:29 pm (utc) on Apr 13, 2010]
[edit reason] example.com [/edit]

jdMorgan

6:09 pm on Apr 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use Apache mod_rewrite. Examine the requested hostname (subdomain, domain, and TLD) using a RewriteCond testing the %{HTTP_HOST} variable. Then rewrite --do not redirect- that request to the correct *filepath* inside your server, using a RewriteRule with that RewriteCond.

See the resources cited in our Apache Forum Charter, our Forum Library, and the mod_rewrite documentation at Apache.org for more info (Links to our resources are at the top of this page). Then post your best-effort code here as a basis for discussion.

Thanks,
Jim