0

Brief

Hey guys, I will qualify this post by saying I'm an .htaccess beginner and am hacking my way through this at the moment. I'm hoping this will yield a solution but also be a learning experience.

Issue

Currently, I'm having trouble removing the .php file extensions from URLs. Previously, all pages were HTML and I had successfully rewritten URLs to drop the .html extensions, but it just doesn't seem to be working for .php — I'm just getting 404 errors.

.htaccess Contents

ErrorDocument 404 http://www.example.com/404.php

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^{.*}$ $1.php [L,QSA]

Any education/advise you can provide would be greatly appreciated. Thanks!

Brian
  • 3
  • 2

0 Answers0