寻求mod_rewrite解决方案 [英] seeking mod_rewrite solution

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

问题描述

我有一个人机网络类型的网站,其中每个用户都有自己的

个人资料页面,其用户ID已编码。因此,例如,他们页面的网页

地址可能看起来像

" www.example.com/my_profile.php?user_id = fdjkhfh2489298hf298h3s0dhfx j。

我希望用户能够选择他们自己的网址,这将是

看起来像www.example.com/Joel"然后当他们输入

地址,它们会自动重定向到他们的个人资料页面,

更复杂的地址。


我相信mod_rewrite是解决方案这个?


读一点mod_rewrite,我相信我想要的规则是

如下:


RewriteRule ^ /(。*)/ redirect_user.php?user_name = $ 1

所以2个简单的问题:

1)这条规则看起来像我想要的是什么?

2)如何安装和连接模块,我是否在.htaccess文件中编写了这个规则




我是mod_rewrite的新手,所以任何帮助都是ap预计。

I have a people-networking type site in which each user has their own
profile page, with their user id encoded. So, for example, the web
address of their page might look like
"www.example.com/my_profile.php?user_id=fdjkhfh2489298hf298h3s0dhfx j".
I want the users to be able to choose their own web address that would
look like "www.example.com/Joel", and then when they type in that
address, they are automatically redirected to their profile page with
the more complex address.

I believe mod_rewrite is the solution to this?

Reading a little bit about mod_rewrite, I believe the rule I want is
something like the following:

RewriteRule ^/(.*) /redirect_user.php?user_name=$1

So 2 simple questions:
1) does this rule look like what I want?
2) how do I install and hook up the module, and do I write this rule
in the .htaccess file?

I''m brand new to mod_rewrite, so any help would be appreciated.

推荐答案

1


所以有两个简单的问题:

1)这条规则看起来像我想要的吗?

2)如何安装和连接模块,我是否写了这个规则

.htaccess文件?


我是mod_rewrite的新手,所以任何帮助都会受到赞赏。

1

So 2 simple questions:
1) does this rule look like what I want?
2) how do I install and hook up the module, and do I write this rule
in the .htaccess file?

I''m brand new to mod_rewrite, so any help would be appreciated.


我是mod_rewrite的新手,所以任何帮助都会受到赞赏。
I''m brand new to mod_rewrite, so any help would be appreciated.




询问一个Apache邮件列表。您将获得更多帮助...



Ask an Apache mailing list. You will get more help...


jo ****** @ gmail.com 写道:
我有一个人际网络类型的网站,其中每个用户都有自己的
个人资料页面,其用户ID已编码。因此,例如,他们网页的网址可能看起来像是www.example.com/my_profile.php?user_id = fdjkhfh2489298hf298h3s0dhfx j。
我希望用户成为能够选择自己的网址,看起来像是www.example.com/Joel",然后当他们输入该地址时,他们会自动被重定向到他们的个人资料页面。更复杂的地址。

我相信mod_rewrite是解决这个问题的方法吗?


是的,它是。

读一点关于mod_rewrite的信息,我相信我想要的规则是如下所示:

RewriteRule ^ /(。*)/ redirect_user.php?user_name =
I have a people-networking type site in which each user has their own
profile page, with their user id encoded. So, for example, the web
address of their page might look like
"www.example.com/my_profile.php?user_id=fdjkhfh2489298hf298h3s0dhfx j".
I want the users to be able to choose their own web address that would
look like "www.example.com/Joel", and then when they type in that
address, they are automatically redirected to their profile page with
the more complex address.

I believe mod_rewrite is the solution to this?
Yes, it is.
Reading a little bit about mod_rewrite, I believe the rule I want is
something like the following:

RewriteRule ^/(.*) /redirect_user.php?user_name=


这篇关于寻求mod_rewrite解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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