I am wondering if this is possible. Lets assume I have a site xyz.com I am going to have pages on the site which are going to look like this: http://www.xyz.com/members.php?username=naif Could I do this: Create a subdomain named naif.xyz.com using .htaccess ? So whenever a user tries to access http://naif.xyz.com, the content for the page is fetched by forwarding the request to file members.php, passing naif as an argument ? I need to take care of this too: This rule should be ignored for the word 'www'. I really hope this is possible. Looking forward to see a solution Thanks, -- Naif
To add subdomains, you have to define a DNS A entry for every subdomain (with bind for example, you can do it by adding an entry called *) And then, you add a virtualhost in your apache configuration (can't be done with .htaccess) where all your subdomains are pointing to the same directory. After that, you watch with your script which subdomain it is and which is the user. Sorry, there's no other solution.
No Cancer. That doesnt help. The reason I made this post here on DP instead of searching for one on my own is because most of what I was able to find was redirecting subdomains to directories and not files *sigh* @Kazhar: Could you elaborate on this? Or maybe point me to an article? Thanks, -- Naif
There are plenty of articles about using DNS, and adding virtualhosts. But I never saw any about doing all this. And articles I know are for the most of them in french. But There's a lot of that kind of help a bit everywhere You've to do two things : - Add an * DNS entry (watch A and CNAME DNS entries) - Create a virtualhost for all your subdomains (which means a virtualhost for the * subdomains). But as I said before, this can't be done via .htaccess.
Kazhar. Finally, after hours of time spent on google, I've come up with a solution. Thats exactly what I had to do. I have no experience working with the language used by Apache. So had to collect all bits and pieces but now, alot of that code makes sense to me I was able to achieve this using .htaccess I sent a mail to the technical support of my host and asked them to enable domain wildcards. Then I tried using the .htaccess file I created. And after domain wildcards were enabled, everything seems to be working fine..