homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Wildcard DNS, Subdomain and mod rewrite
rewrite any.site.com -> /root-of-site/test.php?subdomain=any

10+ Year Member

Msg#: 3104297 posted 2:27 pm on Oct 1, 2006 (gmt 0)

My DNS setting looks like this:

site.com A:
www. A:
*. A:

site.com is IP based site. Both www.site.com and anything.site.com point to same IP ( There are /index.html and /test.php under root folder of site.com.

I want

1. site.com 301 redirect to www.site.com, and
2. www.site.com shows /index.html and
3. others.site.com shows /test.php?subdomain=others
4. others.site.com/file1/file2.html shows /file.php?subdomain=others&param1=file1&param2=file2

How to create the /.htaccess file?


[edited by: iProgram at 2:30 pm (utc) on Oct. 1, 2006]



WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 3104297 posted 5:32 pm on Oct 5, 2006 (gmt 0)

Because of potentially high demand and relativley few contributors, we cannot write your code for you> But we will be glad to help you get it working -- Please see our forum charter.

To get started, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

There are also many past threads on this subject, and a search on WebmasterWorld for "subdomain sudirectory rewritecond http_host rewriterule" should reduce the number of search results to help turn them up.


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