i am hosting an internet site via a webhost [1] on the linux/apache server. so far i serve the various content through one script with parameters. a good example url is


now i wish to alter the plan the url consists of to a thing that looks completely just like a path url. eg.:


with this i have to turn off the standard mapping of url pathways to directory folders in apache: all demands to any or all pathways is going to 1 central script (pages.php), which than evaluates the road element of the url.

how do you tweak apache with this? i really hope some .htaccess rules is the trick.

[1] btw, the webhost is godaddy.com.

Something similar to:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} ! -f
RewriteCond %{REQUEST_FILENAME} ! -d
RewriteRule . pages.php

should rewrite every request personal files or directory that does not exist to pages.php. This will help you to keep static files (images, stylesheets, etc) within the same document root.

(Shamelessly stolen from WordPress :) )

You're searching for mod_rewrite. Example htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^pages/([^/]*)/(.*)$ pages.php?$1=$2

Instead of parse the url inside your script, you need to have the ability to handle the particular example above with Apache's ModRewrite module.


You should use these within the .htaccess file, presuming your host enables this.