Aditya P Bhatt
Aditya P Bhatt

Reputation: 22071

redirect .php to .html extensions 404 error

I'm trying to convert all .php files to run with .html extensions but it gives me 404 Page Not found error:

If I run files with .php extension, it runs well but not with .html extension, I have checked mod_rewrite is enabled as well.

I'm having Ubuntu 12 version and PHP 5.3 installed.

htaccess code is as below:

AddHandler application/x-httpd-php .php .html
AddType application/x-httpd-php .html
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php [L]
#RewriteCond %{REQUEST_URI} ^(.*)\.php$
#RewriteRule ^(.*) /$1.html [R=301,L]

Please help me, whats wrong?

Thanks !

Upvotes: 1

Views: 504

Answers (1)

Aditya P Bhatt
Aditya P Bhatt

Reputation: 22071

it works with:

RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]

Upvotes: 1

Related Questions