用斜杠替换 URL 查询字符串以获得友好的 URL [英] Replace URL query string with slash for a friendly URL

查看:20
本文介绍了用斜杠替换 URL 查询字符串以获得友好的 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下查询字符串

?eve=MTkzODMwMjk0OQ==

?eve=MTkzODMwMjk0OQ==

根据eve的值改变节点body的内容.

to change the content of the node's body according to the value of the value of eve.

完整的 URL 如下所示:

The full URL looks like this:

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

http://localhost/party/event.php?eve=MTkzODMwMjk0OQ== I would like to clean up the url to look like this instead:

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

我怎样才能做到这一点?

How can I do this with ?

推荐答案

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

You can even omit .php to make it more clean

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==

这篇关于用斜杠替换 URL 查询字符串以获得友好的 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆