Remove .php from urls with htaccess

前端 未结 5 1669
抹茶落季
抹茶落季 2020-11-27 04:20

EDIT: current .htaccess file:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

## hide .php extension snippet

# To          


        
5条回答
  •  醉梦人生
    2020-11-27 05:03

    Here is the simplest syntax I have found, which would result as below:

    RewriteEngine on
    RewriteRule ^/?PrivacyPolicy$ legal.php?mode=privacy [NC,L]
    RewriteRule ^Report/([0-9]+)$ report.php?id=$1 [NC,L] 
    

    Results:

    1. PrivacyPolicy to legal.php?mode=privacy
    2. Report/55 to report.php?id=55

提交回复
热议问题