Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-28-2012, 09:04 PM   PM User | #1
Microbug
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Microbug is an unknown quantity at this point
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 09:17 AM.. Reason: Has now been moved, deleting move request.
Microbug is offline   Reply With Quote
Old 10-01-2012, 01:38 AM   PM User | #2
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 449
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
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/
stevenmw is offline   Reply With Quote
Users who have thanked stevenmw for this post:
Microbug (10-01-2012)
Old 10-01-2012, 06:33 PM   PM User | #3
Microbug
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Microbug is an unknown quantity at this point
Thx, that works well! What was wrong with the old one?
Microbug is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:17 AM.


Advertisement
Log in to turn off these ads.