How can I delete .html or .php extension in apache with htaccess?



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]
(ex) magsty.net/index.html -> magsty.net/index

2.delete .php extension
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{DOCUMENT_ROOT}/$1.php -f 
RewriteRule ^(.+)/?$ /$1.php [L]
(ex) magsty.net/index.php -> magsty.net/index

3.delete .jsp extension
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{DOCUMENT_ROOT}/$1.jsp -f 
RewriteRule ^(.+)/?$ /$1.jsp [L]
(ex) magsty.net/index.jsp -> magsty.net/index

Thanks for watching and write the commet to rewrite request or question

Post a Comment

1 Comments

  1. Add a variety to your betting slip, enter an amount, and click on} confirm to position your bet. Right Angle Sports considered one of the|is amongst the|is probably certainly one of the} most influential betting syndicates within the American market. It contains 10 handicappers positioned in numerous areas of the country. As half of} their 카지노사이트.online handicapping routine, they carefully monitor social media for news, and when RAS bets, lines move instantly and sometimes dramatically at sportsbooks around the globe. Some of these line-moving bets may be sparked in part by, of all issues, an emoji posted by a participant on Twitter. Betting in-play considered one of the|is amongst the|is probably certainly one of the} most exciting ways to bet, and profitable in-play bettors will carefully follow the live match, responding quickly to altering occasions and to fluctuating prices.

    ReplyDelete

recent post