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

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

问题描述

我使用以下查询字符串



?eve = MTkzODMwMjk0OQ ==



更改内容

完整的URL如下所示:



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



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



如何我使用?

解决方案

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

 选项+ FollowSymLinks 

上的RewriteEngine RewriteRule event / eve /(.*)/ event.php?eve = $ 1
RewriteRule event / eve /(.*)event.php?eve = $

示例URL

  http:// localhost / pa rty / event / eve / MTkzODMwMjk0OQ / 

将转移到

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


I use the following query string

?eve=MTkzODMwMjk0OQ==

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

The full URL looks like this:

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 ?

解决方案

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

Example URL

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

will transfer to

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

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

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