【发布时间】:2018-03-18 21:48:51
【问题描述】:
我决定放弃 Wordpress,转而使用 Pico CMS。
现在我正在努力正确完成 URL 重写。
我已经设法从例如重写查询字符串。 https://www.example.org?page 到 https://www.example.org/page 使用 RewriteRule ^(.*) ?$1 [L],但现在如果有 是 查询字符串,我也希望它重写。
例子:
如果请求https://www.example.org?page,它可以正常加载,但我希望将其重写为https://www.example.org/page - 至少在地址栏中。
我尝试了几种变体,但都无济于事。我很讨厌正则表达式...
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^\\?/(.*)$ $1
没有
RewriteRule (^\?$) https://tanghus.net/$1 [NC,R=301,L]
RewriteRule ^.*$ https://tanghus.net/? [NC,R=301,L]
没有骰子
RewriteCond %{QUERY_STRING} .
RewriteRule ^$ %{QUERY_STRING} [R,L]
噗
RewriteCond %{THE_REQUEST} \?\sHTTP [NC]
RewriteRule ^ %{REQUEST_URI} [L,R]
放弃:(
【问题讨论】: