Web Application Architechture Part II |
[eluser]Neeraj Kumar[/eluser]
Hi all! I have already asked this question but I am still facing this problem. I want to use wildcard subdomains for my next web app. I am developing it on a windows machine with Apache PHP and MySQL. basic structure of my app will be: * There will a custom subdomain url for each of client of my web app. for eg. Code: user.domain.tld Code: domain.tld/index.php/company/index/user Right now I am developing this web app locally therefore I need to set this up on my local machine. Till now what I have learnt from various tutorials on the internet is: 1) I need to edit and add manually subdomains in my hosts file. I did this in mmy etc\hosts: Code: 127.0.0.1 localhost 2) I need to do something with my apache configuration. Code: <VirtualHost *:80> 3) then I need to write an .htaccess rewrite cond to remap my url to something else. out of above steps, step 1 was what I was able to conquer. With rest of the steps i need help. I am using WAMP on windows vista. so my questions in general: 1) I want to use wildcard subdomains in my CI app. best example of this is: Basecamp from 37signals http://www.basecamphq.com/ 2) what is the best way of doing this, on localhost as well as on real domain. 3) if anybody has already accomplished this, please guide me with the steps.
[eluser]DCZ[/eluser]
(I'm not used to working on windows, but I assume Apache works in the same way as on linux :-)) I'll give an example of redirecting a subdomain to a specific folder. Step 2. (edit httpd.conf) ServerName mysubdomain.server.tld NameVirtualHost *:80 <Directory "/www/subdomain"> AllowOverride None Options Indexes FollowSymLinks Order allow,deny Allow from all </Directory> #Default webpage, when accessing the server without subdomain <VirtualHost *:80> DocumentRoot /www/domain ServerName www.server.tld ... </VirtualHost> #Accessing a subdomain <VirtualHost *:80> DocumentRoot /www/subdomain ServerName www.mysubdomain.server.tld ... </VirtualHost> 3. Done ;-) So in the Apache you define a directory where you files are located (if it is not the default document root) Then you create a virtualhost for each subdomain and point to the a different documentroot. Hopes this helps
[eluser]Neeraj Kumar[/eluser]
Hi DCZ, Your method seems to be good, But I think, I can do same using .htaccess ? Is it right?
[eluser]DCZ[/eluser]
Yes it is possible. Maybe read this post: http://www.webmasterworld.com/forum92/3555.htm |
Welcome Guest, Not a member yet? Register Sign In |