I want to remove .php extension from given any file name with htaccess and add trailing slash with query string. It should work in localhost also.
Case 1: http://localhost/demo/order/?oid=123&stat=open (in the browser) to http://localhost/demo/order.php?oid=123&stat=open (internal) Case 2: http://mydomain.com/order/?oid=123&stat=open (in the browser) to http://mydomain.com/order.php?oid=123&stat=open (internal) It should work for any file name like order.php, contact.php, member.php, ... I tried this, it is working but I want to add trailing slash at the end of the file name with query string
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)$ $1.php?%1 [NC,L,QSA] I tried many, but not exactly reached to my requirement. Like remove .php extension, add trailing slash, add query string. But not all these in one .htaccess file. I want all these in one .htaccess file as specified in the above requirement.
Plz help me. Thanks in advance.