URL重写+ htaccess [英] URL rewrite + htaccess

查看:87
本文介绍了URL重写+ htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。

我有一个域名,我希望每个查询字符串

重定向到index.php?

so domain。 com / foo / bar实际上是domain.com/index.php?/foo/bar

然后我希望能够在index.php中说,

if QUERY_STRING == foo,做这个等等。

(怎么样)我能用htaccess做这个吗?


谢谢!

Hi there.
I have a domain, and i want every query string
redirected to index.php?
so domain.com/foo/bar would actually be domain.com/index.php?/foo/bar
Then i want to be able to say in index.php,
if QUERY_STRING == foo, do this etc.
(How) can i do this with htaccess?

thanks!

推荐答案

frizzle写道:
frizzle wrote:
你好。
我有一个域名,我希望每个查询字符串都重定向to index.php?
所以domain.com/foo/bar实际上是domain.com/index.php?/foo/bar
然后我希望能够在index.php中说,<如果QUERY_STRING == foo,请执行此操作等。
(如何)我可以使用htaccess执行此操作?

谢谢!
Hi there.
I have a domain, and i want every query string
redirected to index.php?
so domain.com/foo/bar would actually be domain.com/index.php?/foo/bar
Then i want to be able to say in index.php,
if QUERY_STRING == foo, do this etc.
(How) can i do this with htaccess?

thanks!




RewriteEngine On

RewriteRule ^(。*)



RewriteEngine On
RewriteRule ^(.*)


index.php?
index.php?


1


如果你想:

example.com/ foo / bar /?id = 10工作:


RewriteRule ^(。*)
1

If you want:
example.com/foo/bar/?id=10 to work:

RewriteRule ^(.*)


这篇关于URL重写+ htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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