Blog IT : smartphone and computer technology

www.domainesia.com

Selasa, 24 Juli 2018

How to Remove .html and .php Extension in the URL using .htaccess

Creating our .htaccess File
Lastly, we create our .htacess file. Create a new file, name it as .htaccess and paste the below codes.

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
#RewriteRule ^([a-z]+)\/?$ $1.php [NC]


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
#RewriteRule ^([a-z]+)\/?$ $1.html [NC]

</IfModule>


EmoticonEmoticon