lighttpd mod_rewrite all

发布于 2024-08-08 02:34:10 字数 310 浏览 1 评论 0原文

我需要一个正则表达式来执行以下操作:

  • 则将每个请求重定向到 index.php
  • 如果网址中有 get 参数,

我需要使用 $_GET[] (php) 访问它们我的(不完整)解决方案是:

url.rewrite-once = (
   ".*\?(.*)$" => "/index.php?$1&full_request=$0"
)

但是这里的错误是不是如果没有“?”在网址中,我收到“404 未找到”。

预先感谢您的帮助, 地塞克斯

i need an regex to do the following:

  • redirect EVERY request to the index.php
  • if there are get parameters in the url i need to access them with $_GET[] (php)

My (not complete) solution is:

url.rewrite-once = (
   ".*\?(.*)$" => "/index.php?$1&full_request=$0"
)

But the error here is that if there's not an "?" in the url i get an "404 not found".

Thanks in advance for help,
dexcs

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

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

发布评论

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

评论(1

雪落纷纷 2024-08-15 02:34:10

试试这个:

url.rewrite-once = (
    "^/[^?]*(\?(.*))?$" => "/index.php?$1&full_request=$0"
)

Try this:

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