创建简单的 URL(.htaccess - mod_rewrite)

发布于 2024-08-26 18:47:49 字数 118 浏览 3 评论 0原文

我的导航有这样的结构index.php?v=page

我希望将其转换为:www.domain.com/page/ - 使用mod_rewrite..对此有什么想法吗?我读了一些图和例子,但无法让它正常工作。

I have this structure for my navigation index.php?v=page

I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some tuts and examples, but couldnt get it working right.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事还在继续 2024-09-02 18:47:49

这里有一些例子。

RewriteEngine on

# www.domain.com/page/example changed to index.php?page=example
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

# www.domain.com/example changed to index.php?v=example
RewriteRule ^example(/)?$ index.php?v=example [L]

第二条规则听起来像是你所追求的。

Here's some examples.

RewriteEngine on

# www.domain.com/page/example changed to index.php?page=example
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

# www.domain.com/example changed to index.php?v=example
RewriteRule ^example(/)?$ index.php?v=example [L]

The second rule sounds like what you're after.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文