Nathan Brown
Nathan Brown

Reputation: 257

404 Error When the file exists, New Files seem Blocked

I am editing a website for a client and have hit a bit of a roadblock. Most of the website is done in php if that matters. I can edit and publish existing pages just fine, but if I were to create a new .php or .html page and try to view it online, I get sent to the 404 error page. Initially I thought this had to do with the .htaccess files but I could not find anything wrong there. If I take the same exact code from the page I want to add and overwrite an existing page with the code, it works fine. Below is the code for the .htaccess file that only includes a rewrite. I can't think of what may be blocking me from viewing my new pages. I appreciate the help guys!

Edit: It appears the htaccess file below is the issue, when deleted everything works fine but I loose my rewrites. Can anyone suggest a better way to accomplish the rewrites in htaccess to allow surfing without extension names? Eg. website.com/home instead of website.com/home.php

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|uploads|db|fonts|blogger|support|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Upvotes: 0

Views: 3565

Answers (1)

Zak
Zak

Reputation: 7525

If you want to remove the extensions in your .htaccess file .. This is what I use:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]
RewriteRule ^([^\.]+)$ $1.htm [NC,L]

Upvotes: 1

Related Questions