将 URL 变量重写为 HTML 文件

发布于 2024-12-23 15:15:07 字数 300 浏览 2 评论 0原文

我见过很多这些重写问题的案例,但我没有得到所有常规表达式和浏览器错误等,所以我希望有人可以帮助我。

好的,我有一个带有 url 变量“pages.php?p=foo”的文件,我想重写它,以便它在同一目录中显示为“foo.html”。

我的想法是这样的:

RewriteRule (.+).html pages.php?p=$1

问题是,浏览器显示 400 Bad Request 错误。

我希望能解决这个问题,但我无法解决这个问题。

非常感谢任何帮助:)

I've seen many cases of these rewrite questions but I don't get all the regular experessions and browser errors and such so I was hoping that someone could help me.

Ok, so I have a file with a url variable 'pages.php?p=foo' and I would like to rewrite it so that it appears as 'foo.html' in the same directory.

I was thinking along the lines of:

RewriteRule (.+).html pages.php?p=$1

The trouble is, the browser displays 400 Bad Request errors.

I'm hoping there's a fix for this but I can't get my head around it.

Any help is much appreciated :)

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

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

发布评论

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

评论(1

硬不硬你别怂 2024-12-30 15:15:07

试试这个:

 RewriteRule (.*)\.html pages.php?p=$1

Try this:

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