Thread: htaccess advice
View Single Post
  #1 (permalink)  
Old 03-24-2008, 10:29 AM
curtiss's Avatar
curtiss curtiss is offline
Moderator
 
Join Date: May 2003
Posts: 1,468
htaccess advice

I'm writing a very simple CMS application to make my life a little easier. I am currently developing the CMS to work the following way:

The root URL will be something like:
http://www.example.com/index.php

Any top level links will look like:
http://www.example.com/mypage/index.html (which will actually point to http://www.example.com/index.php?pagename=mypage)

Any links that specify "mypage" as their parent page will look like:
http://www.example.com/mypage/mylowerpage/index.html (which will actually point to http://www.example.com/index.php?pagename=mylowerpage)

As we go on down the outline, we will continue nesting directories depending on how the parent structure is set up.

Basically, I need to set up an htaccess file that will rewrite my URLs. I need the rewrite engine to pick up the last directory in the URL, whether that's the only directory or the 20th directory in the URL (for example, in http://www.example.com/dir1, it would pick up "dir1", but in http://www.example.com/dir1/dir2/dir...dir6/dir7/dir8, it would pick up "dir8" instead).

I basically have figured out how to do that, but I've run into a problem trying to figure out how to deal with the variance that may exist in the way the URLs are typed. For instance, obviously I want http://www.example.com/dir1/dir2 to lead to the same place as http://www.example.com/dir1/dir2/ and http://www.example.com/dir1/dir2/index.html.

Ideally, I would also like http://www.example.com/dir1/dir2.html to lead the same place, too.

Does anyone have any advice on how to set up my rewrite? Please help. Thank you.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote