Wednesday, February 28, 2018

How to remove .php from urls with htaccess in php.

url :-
http://hostname/product.php

create a .htaccess file on root directory  and paste following code :-

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

then you can access set your link like :-
 http://hostname/product

No comments:

Post a Comment