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

Please help me find the basic Mod rewrite for a subdomain.

 10:28 pm on Jun 27, 2003 (gmt 0)

My Web site is simple with only html pages. I'm trying to add a subdomain and the tech at my ISP has put in a request for the "DNS addition". He told me to add a Mod file to the htaccess file on my site. I'm not sure what the file should contain or where I should put it.

Would the following file be correct for the Mod file? Should I save it as an htaccess file and put it in the directory which will house my subdomain files?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [NC]
RewriteCond %{REQUEST_URL}!^/subdomain/
RewriteRule (.*) /subdomain/$1 [L]

I already use htaccess files to password protect several folders on my main domain. I would not want this new htaccess file to interfere with those password protected folders or with the htaccess file for a 404 ErrorDocument which I put in my domain root.

Thank you in advance for any help you can give me.



 11:00 pm on Jun 27, 2003 (gmt 0)

See if this thread helps


 6:51 am on Jun 28, 2003 (gmt 0)


Welcome to WebmasterWorld [webmasterworld.com]!

Your tech support person used "loose" language. I am sure he meant to say, "Add a mod_rewrite rule to your existing .htaccess file in your web root (top-level) directory to rewrite the subdomain to a subdirectory."

There is no such thing as a "Mod file" - you just need to add the code in the thread that wilderness cited (or something similar) into your existing top-level .htaccess file.


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