Skip to content Skip to sidebar Skip to footer

Remove .html From Url In Apache2

I am trying to remove .html so the site is www.example.com/login login.html is located in /var/www/html/login.html I created .htaccess in /var/www/html/.htaccess And I put in: Rew

Solution 1:

Try it this way.

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$$1.html [L]

Apparently you changed your question.

Solution 2:

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

Post a Comment for "Remove .html From Url In Apache2"