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.
Subdomains with Apache
Moderator: General Moderators
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.
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:
The rule seems okay on first inspection. I re-read your post and missed something the first time around...
Not familiar with godaddy, but you're right, you should need a wildcard subdomain in order for foo.domain/bar.domain to resolve correctly.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?