Remove .php from URL

后端 未结 11 936
生来不讨喜
生来不讨喜 2020-12-15 22:17

Ubuntu 14.04LTS 32bit

LAMP

I know it\'s an old question but..

I need it to remove .php anywhere it finds it from the visible url. It needs to work wi

11条回答
  •  北海茫月
    2020-12-15 22:30

    You can try the following.

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

提交回复
热议问题