如何重写
www.example.com/test.php?search=demo
到
www.example.com/test/?search=demo
使用htaccess
答案 0 :(得分:1)
将其放入.htaccess
:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9]+)/?$ $1.php
答案 1 :(得分:0)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php