homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

non-www to www WITH subdomains
need help with correct configuration

 7:40 am on Jun 27, 2013 (gmt 0)

I am using the following for non-www to www on my sites :

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

I want to add a subdomain such as blog.example.com. I have two issues to figure out :

1 - Exclude the subdomain from the above rewrite as it currently rewrites blog.example.com to example.com/blog/

2 - The actual subdomain location is /blog/, but that should never be accessible to people or engines. So, /blog/* should always be blog.example.com/*

I'm guessing this is a pretty common thing, but I have not used subdomains in ages. Any recommendations would be great... I would like to keep the original rewrite intact since it is the most complete non-www to www I was able to come across to date.




 10:40 am on Jun 27, 2013 (gmt 0)

this thread describes a similar situation to yours.

rewrite subdomain to folder:
http://www.webmasterworld.com/apache/3404559.htm [webmasterworld.com]


 12:15 pm on Jun 27, 2013 (gmt 0)

please see further discussion in this duplicate thread.

non-www to www WITH subdomains - Apache Web Server forum:
http://www.webmasterworld.com/apache/4588079.htm [webmasterworld.com]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved