View Full Version : Remove Subfolder From URL - Old School Static PHP Site

05-04-2011, 07:18 PM
Hi Codingforums.com... i really need and appreciate help with a basic .htaccess rewriting task.

Here's the deal... i'm working with an 'old school' static folder setup where every content page on the site is simply folders and subfolders containing an index.php file.

Root Setup:

/content -- Top Level Pages And All There Sub Pages Stored Here.
index.php -- Home Page

My Page Structure From /content folder:

/content/toppage/ ||||||||||||||| Top Category or Page if you will
/content/toppage/sub1/ ||||||||| Sub Page of Top Page
/content/toppage/sub2/sub3/ ||| Sub of A Sub

How I would Like My URLs to be Rewritten :)

/content/toppage/ ---------------------> site.com/toppage/
/content/toppage/sub1/sub2/ ---------> site.com/toppage/sub2/
/content/toppage/sub1/sub2/sub3/ ---> site.com/toppage/sub3/

Essentially, the content folder will be removed from urls and then each top page's sub folders will never appear to be more than one folder away.

I figure if someone can show me how to rewrite up to 3 levels like this, i'd be able to figure out more and be able to organize my topics with as many subfolders as i want

thats about it. Obviously i still need my root folders such as images/ and includes/ & css/ to function like normal and the root index.php to be my home-page.

THANKS for looking and appreciate the help!

05-06-2011, 05:51 AM
please, im dyin here :confused:

05-17-2011, 10:35 PM
hard to believe there is really no useful / readable info on how to do what im asking in this thread on the entire web.... at least that i've been able to find searching. I'd assume many webmasters have rewrote their folder structures like im hoping to do.

06-22-2011, 02:53 PM
Ha I've also been experiencing problems with a situation simular to this :( .... any help would be well appreciated so please help out. Thanks in advance.

01-09-2012, 10:59 PM
Im still hoping for an answer, if it would help, here is one of my sites (http://onlinepokerbest.com) i am trying to achieve this on.