Forum Moderators: phranque

Message Too Old, No Replies

Need some help with mod rewrite

help with mod rewrite

         

mastermindsro

6:53 am on Oct 11, 2009 (gmt 0)

10+ Year Member



Hi,

I will get straight into my problem.. so
I have some main sections: Home, Services, Portfolio etc.
The sections can be found on the following url:
mywebsite.com/home.php
mywebsite.com/services.php
mywebsite.com/portfolio.php

--

I want to have some sub-sections for services: Logo Design, Brochure Design etc.
Here's the trouble..

I want to keep all the files in the root, that's why I will name those pages like:
mywebsite.com/logo_design.php
mywebsite.com/brochure_design.php

My question is: How can I make (by adding some code to .htaccess in root)

mywebsite.com/services.php look in browser like mywebsite.com/services
and
mywebsite.com/logo_design.php look in browser like "mywebsite.com/services/logo_design"

THANKS

jdMorgan

3:27 pm on Oct 11, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use mod_rewrite to check for the absence of a "filetype" in the requested URL-path, add ".php" if it is missing. This is an internal rewrite -- a URL-path-to-filepath translation.

Try a search here on WebmasterWorld (see the "Search" link at the top of this page) and look for "extensionless URL RewriteCond RewriteRule" and similar phrases to turn up dozens of previous threads on this subject. The resources in our Apache Forum Charter and our forum Library may be quite helpful to you.

Jim