如何从网站的网址中删除参数?

时间:2019-07-17 18:52:08

标签: .htaccess

我想将我的URL从localhost/profile?id=1更改为localhost/profile/1

# Run Php without filename extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)$ $1.php

# Return 404 if original request is .php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]

这是我当前的.htaccess代码。这只会删除php扩展名。

0 个答案:

没有答案