Apache Lounge



Forum Index Downloads Search Register Log in  RSS Apache Lounge

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.

Working with clean URLs

Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner

View previous topic :: View next topic  
Author Message

Joined: 27 Mar 2012
Posts: 2
Location: Germany

PostPosted: Thu 27 Dec '12 1:29    Post subject: Working with clean URLs Reply with quote


I have read numerous posts in this forum regarding clean URLs but its either I am not understanding or none of the posts relate to my situation.

First my code .htaccess:


RewriteRule ^(([^/]+/)*[^/.]+)$ index.php?page=$1 [L]

My folder structure:

Content - this folder contains all of the called pages
index.php - all pages are called into this file using GET

The result of the above in URLs is a follows:


The problem I have is when I want to call a second level for example:


So just to recap all of the physical files are located in the Folder "content", though I believe from what I have been reading this is irrelevant.

Or do I have to create separate folders for each?

Primarily this is a mod_rewrite question so any help would be great
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6460
Location: Germany, Next to Hamburg

PostPosted: Tue 08 Jan '13 12:42    Post subject: Reply with quote

Easiest way it to push everything that does not exist through your file


RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1
Back to top

Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1