隐藏获取参数

时间:2016-07-04 20:03:49

标签: php .htaccess

得到:

https://xxx.ru/page/?page=update-1/

如何展示:

https://xxx.ru/page/update-1/

我试过不行 htaccess的

RewriteBase /
RewriteEngine on

RewriteRule ^page\/(.*?)/?$ page/?page=$1 [L,QSA]

2 个答案:

答案 0 :(得分:1)

使用此:

RewriteEngine On
RewriteRule ^page/([^/]*)$ /page/?page=$1 [L]

它将为您提供以下网址:

https://xxx.ru/page/update-1/

答案 1 :(得分:1)

您可以使用:

RewriteEngine on
RewriteBase /

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+page/\?page=([^\s&]+) [NC]
RewriteRule ^ /page/%1? [R=302,L,NE]

# internal forward from pretty URL to actual one
RewriteRule ^page/(.+)$ page/?page=$1 [L,QSA,NC]