williamsongibson
williamsongibson

Reputation: 277

htaccess renaming .php files to .html files giving file not found errors?

I'm using this code to rewrite my php files to be html files, so technical.php would appear as technical.html

RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]

but it gives me a 404 error when visiting technical.html

Not Found

The requested URL /technical.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Did I get the order wrong in my htaccess?

Upvotes: 0

Views: 513

Answers (2)

williamsongibson
williamsongibson

Reputation: 277

Adding an .htaccess rule in the subfolder the files were in fixed this! I thought one .htaccess in the root, controlled the entire site.

Upvotes: 0

Headshota
Headshota

Reputation: 21449

Probably you'll have to specify the app folder as well:

RewriteRule ^(.*)\.html$ appFolder/$1.php

Upvotes: 1

Related Questions