943,900 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 458
  • PHP RSS
May 21st, 2009
0

mod_rewrite subdomains

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
koolhq is offline Offline
9 posts
since May 2009
May 21st, 2009
0

Re: mod_rewrite subdomains

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
Reputation Points: 210
Solved Threads: 228
Nearly a Posting Virtuoso
chrishea is offline Offline
1,389 posts
since Sep 2008
May 21st, 2009
0

Re: mod_rewrite subdomains

Google for Wildcard DNS
Sponsor
Reputation Points: 265
Solved Threads: 126
Practically a Master Poster
mschroeder is offline Offline
624 posts
since Jul 2008
May 21st, 2009
0

Re: mod_rewrite subdomains

I figured it out and for anyone who is reading this save the following as .htaccess in public_html

PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
koolhq is offline Offline
9 posts
since May 2009
May 21st, 2009
0

Re: mod_rewrite subdomains

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
koolhq is offline Offline
9 posts
since May 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: "Column count doesn't match value" error -Mysql
Next Thread in PHP Forum Timeline: Generate new password every 24 hours?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC