隐藏];的index.php"从URL并获得参数

隐藏];的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.

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