将URL查询字符串替换为友好URL的斜杠

时间:2016-04-23 19:08:15

标签: .htaccess url url-rewriting

我使用以下查询字符串

?前夕= MTkzODMwMjk0OQ ==

根据前夕值的值更改节点主体的内容。

完整网址如下所示:

http://localhost/party/event.php?eve=MTkzODMwMjk0OQ== 我想清理网址,看起来像这样:

http://localhost/party/event.php/eve/MTkzODMwMjk0OQ==

我该怎么做?

1 个答案:

答案 0 :(得分:1)

您甚至可以省略.php以使其更加干净

Options +FollowSymLinks
RewriteEngine on
RewriteRule event/eve/(.*)/ event.php?eve=$1
RewriteRule event/eve/(.*) event.php?eve=$

示例网址

  http://localhost/party/event/eve/MTkzODMwMjk0OQ/ 

将转移到

  http://localhost/party/event.php?eve=MTkzODMwMjk0OQ==