宙斯重写规则

发布于 2024-10-24 19:07:43 字数 510 浏览 7 评论 0原文

我有一个呈现 URL 的网站:

/work.php?cat=identity

通常我会研究如何使用 mod_rewrite,但不幸的是我的主机(Namesco)使用 Zeus 而不是 Apache,这很奇怪。我将如何使用 Zeus 的重写规则转换为:

/work/identity

这是一个更干净、更好的 SEO 友好版本。除此之外,我仍然需要 $_GET 变量处于活动状态,因为它从数据库请求有关变量 cat 的信息。

我以前从未重写过 URL,所以我不知道从哪里开始。我尝试使用保存在我的 Web 文件夹中的 rewrite.script 文件进行更改,

match URL into $ with ^/work.php?cat=/(.*)
if matched set URL= /work/$

不幸的是它不起作用。任何人都可以提供帮助或提供替代方案吗?

I have a website that renders the URL:

/work.php?cat=identity

Normally I would research how to use mod_rewrite but unfortunately my hosting (Namesco) uses Zeus and not Apache, which is strange. How would I use Zeus' rewrite rules to convert to:

/work/identity

This is a much cleaner, nicer SEO friendly version. On top of this, I still need the $_GET variable to be active because it requests information about the variable cat from the database.

I've never rewritten URLs before so I've no idea where to begin. I've attempted the change with this rewrite.script file which is saved within my web folder

match URL into $ with ^/work.php?cat=/(.*)
if matched set URL= /work/$

Unfortunately it doesn't work. Can anyone help or perhaps offer an alternative?

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

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

发布评论

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

评论(3

只为一人 2024-10-31 19:07:43

快速玩了一下,我相信我已经向自己证明了请求重写无法操作 URL 的查询元素。

有一个潜在的解决方案,但它变得更加难看!

您可以使用 ZWS 的“Perl Extensions”来实现此目的。本质上,您将请求传递给 ZWS 中的 Perl 引擎,针对它运行一个脚本,然后将结果传递回 ZWS。

但恐怕这有点超出我的能力范围了!我是“宙斯交通管理员”之类的小伙子……

尼克

had a quick play with this, and I believe I have proven to myself that the Request Rewriting is not able to manipulate the query element of the URL.

There is a potential solution, but it gets even more ugly!

You could use the "Perl Extensions" of ZWS to achieve this. Essentially you pass the request to the Perl engine within ZWS run a script against it, then pass the result back to the ZWS.

I am afraid this is a bit beyond my capabilities however! I am a "Zeus Traffic Manager" sort of chap...

Nick

戏舞 2024-10-31 19:07:43

Zeus 重写规则能够访问 URL 字符串的查询部分。您缺少的关键是输出 URL 上 $ 后面的 1 ,并且应该删除斜杠:

match URL into $ with ^/work.php?cat=/(.*)
if matched set URL= /work/$

应该是

match URL into $ with ^/work.php?cat=(.*)
if matched set URL= /work/$1

Zeus Rewrite Rules are able to access the query part of a URL string. The key thing your missing it looks like is the 1 following the $ on the output URL and the slash should be removed:

match URL into $ with ^/work.php?cat=/(.*)
if matched set URL= /work/$

should be

match URL into $ with ^/work.php?cat=(.*)
if matched set URL= /work/$1
各自安好 2024-10-31 19:07:43

我想知道重写规则是否适用于 URI 的查询部分?这些文档似乎只讨论了路径元素。

http://support.zeus.com/zws/docs/2005/12 /16/zeus_web_server_4_3_documentation

第 141 页似乎是它的开始...

我将尝试启动 ZWS VM 并自己进行测试。

缺口

I am wondering if the rewrite rules are available for the query portion of the URI? The docs do seem to only speak about the path element.

http://support.zeus.com/zws/docs/2005/12/16/zeus_web_server_4_3_documentation

page 141 seems to be the start of it...

I will attempt to fire up a ZWS VM and test this myself.

Nick

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