0

I have all my files with .php extension which I am replacing with .html (code mentioned below) in htaccess file but this piece of code is keeping .html for all the pages(i guess), which is affecting the functionality of few pages like career and contact, as I was using php code to do all my backend job for these pages.

Does any one have any suggestions to pull me out of this. Any help would be appreciated.

Here is the code:

RewriteRule ^(.*)\.html$ $1.php [L]
RewriteRule ^([^/.]+)$ $1.php [L]
Aatif Akhter
  • 2,126
  • 1
  • 25
  • 46
indrjit kumar
  • 33
  • 1
  • 5
  • We need more precise information about what to rewrite and what not to rewrite _exactly_. – arkascha Feb 15 '17 at 11:33
  • Try this: http://stackoverflow.com/questions/4687208/using-htaccess-to-make-all-html-pages-to-run-as-php-files – Aerendir Feb 15 '17 at 12:57

1 Answers1

0

Try below rule,

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

I am assuming you are rewriting non existent html files to actual php files.

Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
  • Hey Abhishek, Thanks for the reply but this didn't serve the solution exactly i was looking for. i will give u little insight of what i am stuck on- – indrjit kumar Feb 16 '17 at 07:10