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
    Sep 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Help with .php extension removal!

    Hi,
    This is my first post so sorry if I sound n00bish.
    I am trying to make my website so that you can get to http://example.com/example.php through http://example.com/example.
    My code works fine (code not mine!), but when I go to a page that should through a 404 error, eg not there, I get a 500 internal server error. Here is my .htaccess code:
    Code:
    Options -MultiViews
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ $1.php [L]
    
    ErrorDocument 403 /403.php
    ErrorDocument 404 /404.php
    Please help if you can,
    Microbug
    Last edited by Microbug; 09-29-2012 at 10:17 AM. Reason: Has now been moved, deleting move request.

  2. #2
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    I'm not sure about individual files, but I know you can hide specific extension types.

    Code:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    Replace php with another file extension to change it, html, htm, asp


    http://eisabainyo.net/weblog/2007/08...-via-htaccess/

  3. Users who have thanked stevenmw for this post:

    Microbug (10-01-2012)

  4. #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thx, that works well! What was wrong with the old one?


 

Posting Permissions

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