...

View Full Version : I need some help with .htaccess rewriting...



Jamesking56
08-28-2011, 11:11 PM
Hey,

I'm trying to make a .htaccess file for my new site.

the first thing I want my .htaccess to do is to change my .php extension into a /. Like so:


http://www.example.com/about.php

to

http://www.example.com/about/


Then, I want it's sub sections to be created logically. Like so:


http://www.example.com/about-section.php

to

http://www.example.com/about/section/


How do I do this in my .htaccess file?

Cags
08-29-2011, 07:57 AM
Change the URL's on your site to look like what you want them to be, then do something along the lines of...


RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/])/?$ /$1.php [L]

RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/])/([^/])/?$ /$1-$2.php [L]

Jamesking56
08-29-2011, 06:19 PM
That code doesn't seem to work at all



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum