On Fri, May 17, 2013 at 5:31 AM, Dan Egli <[email protected]> wrote:

> Hey folks, something I've been wondering. I'm sure we're all used to seeing
> URLS that end in things like /file.php?req=12 or similiar. That's easy. But
> lately I've seen an increasing number of pages that seem to put the php
> page as a directory and the request as a separate file. A good example was
> the ATA wiki page on kernel.org. That read
> ata.wiki.kernel.org/index.php/ATA_Secure_Erase.
>
> I could easily make a page that would pull up content by something like
> index.php?section=ATA_Secure_Erase, but how on earth do you setup Apache to
> recognise in this URL that index.php is not a directory and
> ATA_Secure_Erase not a separate file? Or is that exactly what happened and
> they are simply calling the directory index.php for whatever reason? This
> is something that's been bugging me for a while. The way I understand
> things, you'd need to configure Apache to send the index.php page, and then
> you need to have some kind of IF check to see if ATA_Secure_Erase was set.
> But at the same time, I'd wonder WHAT variable to check. Would it be
> something like $_GET["ATA_Secure_Erase"]? Or would it be
> $_GET["<something>"] == "ATA_Secure_Erase" or similiar?
>

One way to do this is to use mod_rewrite[1] with Apache to translate URLs
from /index.php/PAGE_NAME to /index.php?section=PAGE_NAME. Since you
pointed to a MediaWiki site as your example, you may be interested in the
MediaWiki manual section that describes how to setup the redirects[2].

[1] http://httpd.apache.org/docs/current/mod/mod_rewrite.html
[2] http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

--
Byron Clark

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to