需要帮助从url中删除.php

时间:2015-07-21 10:47:16

标签: php .htaccess

这是我的网址 http://localhost/fad/admin/countries.php

我想将网址更改为 http://localhost/fad/admin/countries

如何更改this.i通过.htaccess更改,但它找不到页面 任何人帮我解决我的所有网站页面删除扩展名

2 个答案:

答案 0 :(得分:0)

试试这个......

RewriteEngine On
RewriteRule ^countries$ countries.php [L]

答案 1 :(得分:0)

将其插入.htaccess:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ $1.php [QSA]
祝你好运!