.htacces Rewrite Rule to Keep .php File Extensions

Posted by user2672112 on Stack Overflow See other posts from Stack Overflow or by user2672112
Published on 2013-10-20T09:50:50Z Indexed on 2013/10/20 9:53 UTC
Read the original article Hit count: 211

Filed under:
|
|

I'm upgrading my static website that had .php extensions on the content pages. I've created my own simple cms which will start retrieving data from mysql database from now on, keeping the url structure same as the old once.

The cms has get function to retrieve url structure from the database. Overall it started working fine with .html when i tested. But when i change the .html extension to .php in my .htaccess code the content pages starts reflecting "Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request."

Here is my .htaccess code which i've used:

RewriteBase / 
Options +FollowSymLinks 
RewriteEngine On
RewriteRule ^([^?]*).php$ content.php?pid=$1

Perhaps there is a conflict, here is the code with .html extension that actually works fine.

RewriteBase / 
Options +FollowSymLinks 
RewriteEngine On
RewriteRule ^([^?]*).html$ content.php?pid=$1

So basically, content pages with .html are working & .php are not working. But i need my content pages to be with .php

Please help. Thanks in advance... :)

© Stack Overflow or respective owner

Related posts about php

Related posts about .htaccess