隐藏];的index.php"从URL并获得参数 [英] Hide "index.php" from URL and get parameters

查看:218
本文介绍了隐藏];的index.php"从URL并获得参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,这是另外一个.httaccess问题...

Yes, this is another .httaccess question...

我发誓我试着尽我所能,使这项工作,但我无法理解清楚如何编写规则。

I swear to god I tried everything I could to make this work, but I can't understand clearly how to write the rules.

我要的是:在输入我的浏览器mydomain.com/x/10,它应该是PTED为mydonain.com/index.php?x=10跨$ P $,所以我可以得到x值并使用它。

What i want is: to type in my browser "mydomain.com/x/10" and it should be interpreted as "mydonain.com/index.php?x=10" so i can get the x value and use it.

我想这样做,所以它更容易连接东西的人。

I wanna do this so it's easier to link stuff to people.

我该怎么办呢?另外,如果有人能提供我一个链接到一个地方,我其实可以学习如何构造正前pressions的htaccess的使用,这将是真棒。

How do i do this? Also, if someone could provide me a link to a place where I can actually learn how to construct the regular expressions that htaccess use, that would be awesome.

推荐答案

是的,另一种的.htaccess的答案;)

Yes, yet another .htaccess answer ;)

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

# Internally forward /x/10 to /index.php?x=10
RewriteRule ^x/(.*)/?$ index.php?x=$1 [L,QSA,NC]

这将重定向:

http://yourdomain.com/x/10

在内部:

http://yourdomain.com/index.php?x=10

所以在用户不看到,在浏览器上。

So on the user does not see that on the browser.

至于链接,了解它,我发现这是一个非常好,因为描述是怎么回事图像的特殊<​​/ STRONG>

这篇关于隐藏];的index.php&QUOT;从URL并获得参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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