Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need some help with .htaccess rewriting...

    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:

    Code:
    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:

    Code:
    http://www.example.com/about-section.php
    
    to
    
    http://www.example.com/about/section/
    How do I do this in my .htaccess file?

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Change the URL's on your site to look like what you want them to be, then do something along the lines of...

    Code:
    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]

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That code doesn't seem to work at all


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •