Re: Non-existant folders??

From: Date: Tue, 23 Jan 2001 14:18:07 +0000
Subject: Re: Non-existant folders??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36191@lists.php.net to get a copy of this message
>>>>> "AM" == "Adrian Murphy" <adrian.murphy@eudos.com> >>>>> writes: > Hi, I'm creating a little app whereby people will be able to create > a simple site for themselves (maybe 10 html pages). here's the > problem: say their company is called "companyname" and my site is > called "www.mysite.com" i'd like their site to be located at > "http://www.mysite.com/companyname" > Is there a way i can do this without creating indivual folders for > each company.I'd like the whole creation process to be automated. > I'm sure the ftp functions in php would allow for the generation of > new folders for each,but since all content/style etc. will be > pulled from a DB it's seems to me a little pointless having all > these folders with the same php page in each.essentially i'd like a > php script to run automatically each time taking what looks like a > folder name and making a call to the db using this name as a > variable. easy, difficult or impossible? thanx, adrian Hiyah, It Depends on your web server. If you're using Apache then you can do it with a few lines in your config file using mod_rewrite. Something similar to: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/([^/]+)/(.*) /scripts/$2 [E=companyname:$1] </IfModule> Which given a url such as http://yoursite.com/mycompany/index.php should (I've not tested it) call /scripts/index.php with the environment variable 'companyname' set to 'mycompany'. You then use this in all your SQL queries. -robin -- Robin Vickery............................................... Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK Email: robin@planet-three.net Phone: +44 (0)870 729 5444

« previous php.general (#36191) next »