How can I delete .html or .php extension with .htaccess?
Before delete .html or .php extension with htaccess,
First, you must activate rewrite module.

First, you must activate rewrite module.
Ctrl+v this code in terminal.
sudo a2enmod rewrite
If you finished the rewrite activating, You can use htaccess in apache.
Let's delete .html or .php extension!
1.delete .html extension
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+)/?$ /$1.html [L]
2.delete .php extension
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+)/?$ /$1.php [L]
3.delete .jsp extension
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{DOCUMENT_ROOT}/$1.jsp -f
RewriteRule ^(.+)/?$ /$1.jsp [L]
Thanks for watching and write the commet to rewrite request or question
0 Comments