如何使用PHP从URL中删除问号

时间:2018-02-12 05:07:54

标签: php .htaccess

朋友请帮帮我,我在网址上遇到了一些问题 重定向我想重写我的网址

目前的网址是 http://localhost/example.com/how-to-remove-question-marks

应重定向为

http://localhost/example.com/how-to-remove-question-marks/

1 个答案:

答案 0 :(得分:0)

看看这个:

RewriteEngine on
# pass-through if another rewrite rule has been applied already
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
# Define static redicts
RewriteRule ^image/(.+)$ public/image/$1 [L,QSA]
RewriteRule ^css/(.+)$ public/css/$1 [L,QSA]
RewriteRule ^js/(.+)$ public/js/$1 [L,QSA]
RewriteRule ^lib/js/core/(.+)$ core/lib/js/$1 [L,QSA]
RewriteRule ^lib/js/(.+)$ public/lib/js/$1 [L,QSA]
RewriteRule ^cache/(.+)$ public/cache/$1 [L,QSA]
RewriteRule ^download/(.+)$ public/download/$1 [L,QSA]

# Define custom redicts
RewriteRule ^page/([0-9]+)$ index.php?path=index.php&page=$1 [L,QSA]

RewriteRule ^(.+)$ index.php?path=$1 [L,QSA]