就像带有 rewritecond 的 twitter url 一样?
我想要一个简单的帮助。我有一个像这样的 URL:/profile.php?id=
。
我的 .htaccess 文件是这样的:
RewriteRule ^profile/(.*)/(.*) profile.php?id=$1&name=$2
所以我有一个像这样的结束 URL:/profile/
。
我可以制作/
。但是我怎样才能获得像/
这样的URL呢?
我可以使用 RewriteCond
来创建条件吗? 我仍然没有很多 .htaccess。
I would like a simple help. I have a URL like this: /profile.php?id=<id>&name=<name>
.
My .htaccess file like this:
RewriteRule ^profile/(.*)/(.*) profile.php?id=$1&name=$2
So I have a end URL like this: /profile/<id>/<name>
.
I can make /<id>
. But how can I get a URL like /<name>
?
I can use the RewriteCond
to make a conditional?
I still don't a lot of .htaccess.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果名称和 ID 的值具有不同的模式,您可以在规则中使用这些模式,例如:
If the names and IDs have a different pattern in their values, you could use these patterns in your rules, for example: