Subdomains with Apache

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
deleet
Forum Commoner
Posts: 28
Joined: Thu Mar 23, 2006 10:05 am

Subdomains with Apache

Post by deleet »

Hello everyone. I'm using a web server with Apache and I need to redirect the users from http://username.domain.com to http://www.domain.com/view.php?u=username.

My problem right now isn't the rewrite rule, I am simply unable to open any page (as in, if I type http://randomness.domain.com I get no page at all, server not found). I called my hosting company and they told me that I had to upload a script to rewrite the URL's (which I thought mod_rewrite did?).

I also read somewhere that I need to add a DNS entry for the domain name, something like http://*.domain.com pointing to my web server's IP address. I cannot do this in my host's administration panel. The domain name is hosted with GoDaddy, am I able to do it there?

I'm not very familiar with this aspect of Apache, help would be greatly appreciated.

Thank you for your time.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Show us your rewrite rule.
deleet
Forum Commoner
Posts: 28
Joined: Thu Mar 23, 2006 10:05 am

Post by deleet »

I don't think the rewrite is the problem but..

RewriteEngine on
rewriterule ^(.+)\.domain.com$ http://www.domain.com/view.php?u=$1 [nc]

Thanks.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

The rule seems okay on first inspection. I re-read your post and missed something the first time around...
I also read somewhere that I need to add a DNS entry for the domain name, something like http://*.domain.com pointing to my web server's IP address. I cannot do this in my host's administration panel. The domain name is hosted with GoDaddy, am I able to do it there?
Not familiar with godaddy, but you're right, you should need a wildcard subdomain in order for foo.domain/bar.domain to resolve correctly.
Post Reply