sub.domain.com/* -> domain.com/sub/* - rewrite

Using a single web hosting account to host multiple sites

Postby thek-nar » Thu Jun 29, 2006 10:48 am

thanks! I'll check this
thek-nar
 
Posts: 4
Joined: Tue Jun 27, 2006 6:27 pm

Postby Theluse » Fri Sep 01, 2006 3:13 pm

I got a similar question, I noticed on Yahoo.com they rewrite URLs like www.music.yahoo.com goes to music.yahoo.com, how can I have it so anything pointing to www.{subdomain}.mysite.com 301 redirects to {subdomain}.mysite.com in my Apache vhost conf file?

Note: I don't need an alias, I want it to redirect. Thanks, any help would be greatly appreciated.
Theluse
 
Posts: 1
Joined: Fri Sep 01, 2006 3:09 pm

Postby richardk » Fri Sep 01, 2006 3:37 pm

Try adding this as the very first <VirtualHost>:
Code: Select all
<VirtualHost *>
  ServerName abc.def.ghi
  ServerAlias www.*

  Options +FollowSymLinks
  RewriteEnigne On
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1$1  [R=301,L]
</VirtualHost>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 62 guests

cron