Seriousely speaking, I don't think I can create you a working example here 
because your case might be a whole different one, so you'd better read the 
docs to get it right. To just give you an idea, here's what I use on 
PHPBeginner.com: 

# VHosts: 

        RewriteEngine On
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
        RewriteRule ^(.+) - [L]
        RewriteRule ^(.+) /index.php?%{QUERY_STRING}&_PHPB_URL=$1 [L] 


basically in human language it is: 

        Line 1: action: start Rewrite Engine
        Line 2: condition: if the requested file exists
        Line 3: solution: go to the untouched URL (the engine would stop here)
        Line 4: alternative: if arrived all the way to this line go to 
"/index.php?query=URL" 


So, in the root we only have one single file (index.php) amd all the 
requests are coming in to it as $_GET['_PHPB_URL'], there we take over the 
game and decide what instances to lunch up from some shared libraries 
outside the root. 

In your case I think it would still similar, except, you could read the 
apache docs better and assign more variables in your regex so you get the 
correct data. Don't be too lazy, soon or later you will need Regular 
Expression again, so thi is a good chance to learn them. :-) 


Cheers, 

Maxim Maletsky
Founder, Chief Developer.
www.PHPBeginner.com 

 


[ rswfire ] writes: 

> I could really use your help with this.  The examples I have received from 
> everyone thus far have not worked, including the last one that you posted. 
> This is the situation: 
> 
> I have multiple domains, each with multiple subdomains, all of which 
> automatically point to the root of my web environment.  I have only one 
> file that does all of the work for all of these websites/webpages, and 
> that is the index.php file in the root.  This file is smart enough to 
> parse the url being accessed and create an appropriate page based on a 
> very complex set of rules. 
> 
> Originally, I was using the ErrorDocument 404 to make it access the 
> index.php file, but this has some inherent flaws.  The biggest problem was 
> that forms that were being posted to a page that doesn't really exist 
> never maintained the posted variables (due to the 404 redirect.)  Another 
> limitation was that it just created a bunch of unnecessary error messages 
> in my error log since there are no "real pages" on my network, even though 
> it pretends there is. 
> 
> So, I need to use mod_rewrite.  That is apparent now.  The problem is I 
> know nothing about creating regular expressions.  I simply need it to 
> rewrite the url for any file that does not exist (it should not try to do 
> so for a file that really does exist, say an image file) and it needs to 
> have the following rule: 
> 
> A*.B*.C*/D*.E* 
> 
> Where A is a subdomain; B is the domain name; C is the top level domain; 
> D/E are a file or directory. 
> 
> Some examples would be: 
> 
> http://www.swifte.net/
> http://www.cao.swifte.net/petition-sign.html
> http://hsdnetwork.swifte.net/technicians.html
> http://www.hsdnetwork.swifte.net/technicians.html
> http://www.caofund.org/
> http://www.hsdnetwork.com/ 
> 
> Can you tell me how to do this?  I would appreciate your help so much!! 
> 
> -Samuel 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> 
 


Maxim Maletsky 

Founder, Chief Developer
PHPBeginner.com (Where PHP Begins) 

www.PHPBeginner.com
[EMAIL PROTECTED] 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to