that's easy.

don't redirect, just do an include() on the PHP file you actually 
want, or if you're using some fancy caching system and alrady have 
the output in a file, do a readfile().

then use Apache's ForceType.

I think it's like:

<Location /news>
ForceType application/x-httpd-php
</Location>

something like that.

then make a file called "news" in the DocumentRoot directory that's like:

$path_array = explode('/', $REQUEST_URI);
$numPathElements = count($path_array);

then loop through the elements and do what you need, you might need 
to use strtok() if you're expecting slashes in your arguments.

put the name of the script in a var, either do a regex or parse_str() 
on the rest of the URI to set the vars you need (like aid=3911)

and then do a include() with the script name.

the URL will never change in the browser, it's one request, and you 
can make a very generic URL parsing script to make your URLs pretty. 
you can set DocumentRoot to this script and then you can have URLs 
like:

http://www.myserver.com/index.html

where actually your script is doing the work.  maybe it includes a 
file called index.html and adds ads on the top or something.  and 
with output buffering you can get even more power, i use output 
buffering to change all my image tags on the fly to a different 
server, but for the people who write the HTML code, they don't need 
to care about it.  PHP is good stuff.

ask if you need more help.

-aaron

At 9:13 AM +1300 3/4/01, Jenni &/or Patrick wrote:
>I'm going to start with a nice simple, hopefully, questions.
>
>Some of you may have seen PCWorld.com - and its urls that are like
>http://www.pcworld.com/news/view/0,aid,3911,00.asp. This is achieved with a
>product called XCache (for IIS, visit www.xcache.com), wich translates this
>url into http://www.pcworld.com/news/view.asp?aid=3911.
>
>Now, you can probably do this in regex, and use the mod_rewrite, but this is
>not available to me, so we can all forget that one right away ;-).
>
>I have created a 404-processor that does the conversion (and even checks if
>the resultant page exsists, by using a simple file_exists();).
>
>Apache (or was it PHP? Or a combination of the above?) used to, when you
>said Header ("Location: /localpath"), just serve up the content, without
>doing a redirect. Under Apache/1.3.17 & PHP/4.0.4 this does not happen.
>
>Is there a way to do this redirect internally - ie. the browser is not even
>aware that the URL is different from the one it requested, let alone the
>visitor.
>
>And no, frames are not really an option: because it would defeat one of the
>reasons I want  to do this internally, which is to prevent the need to do
>two requests.
>
>Hopefully someone will understand this (I'm sure there will be many), and be
>able to guide towards something that will work.
>
>Thanks,
>Patrick.
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to