mod_rewrite subdomains

Thread Solved

Join Date: May 2009
Posts: 9
Reputation: koolhq is an unknown quantity at this point 
Solved Threads: 1
koolhq koolhq is offline Offline
Newbie Poster

mod_rewrite subdomains

 
0
  #1
May 21st, 2009
Ok I am making a website and I have apache 2, php, mysql. I want users to be able to create a website(i got that part, it is easy) but I want

user.example.com to redirect to
example.com/user

with a .htaccess file

and sorry this is in the wrong section can you tell me whee it should have been posted
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 214
Reputation: chrishea is an unknown quantity at this point 
Solved Threads: 32
chrishea's Avatar
chrishea chrishea is offline Offline
Posting Whiz in Training

Re: mod_rewrite subdomains

 
0
  #2
May 21st, 2009
It's worth doing a search of previous postings because most common questions have been asked and answered before. I got this link from a previous post:
http://corz.org/serv/tricks/htaccess2.php

If it doesn't answer your question, there are a number of previous posts that you can look at.

Chris
Chris
See my list of PHP development tools at:
InnovationsDesign.net
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 148
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: mod_rewrite subdomains

 
0
  #3
May 21st, 2009
Google for Wildcard DNS
If you're question/problem is solved don't forget to mark the thread as Solved!

-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 9
Reputation: koolhq is an unknown quantity at this point 
Solved Threads: 1
koolhq koolhq is offline Offline
Newbie Poster

Re: mod_rewrite subdomains

 
0
  #4
May 21st, 2009
I figured it out and for anyone who is reading this save the following as .htaccess in public_html

  1. Options +FollowSymlinks
  2. RewriteEngine on
  3.  
  4.  
  5. RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
  6. RewriteCond %{REQUEST_URI} !^/example\.com
  7. RewriteRule (.*) /example\.com/$1 [L]
Last edited by koolhq; May 21st, 2009 at 4:40 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 9
Reputation: koolhq is an unknown quantity at this point 
Solved Threads: 1
koolhq koolhq is offline Offline
Newbie Poster

Re: mod_rewrite subdomains

 
0
  #5
May 21st, 2009
oh and i also forgot. you have to create a wildcard by adding an A record with the name of * for the ip address of your server
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC