1

不幸的是,我的一位客户在他使用的托管公司使用 Zeus Web 服务器。我以前从未使用过它。

我需要设置简单的 301 重定向,但 Zeus 不使用 .htaccess,它使用自己的文件 rewrite.script

有谁知道如何为 Zeus 使用 rewrite.script 进行基本的 301 重定向?相当于:

重定向 301 /pagename http://domain.com/newpage.php

在 .htaccess 中。

实际文件名也发生了变化,所以我不能直接重定向整个域,我需要为所有 20 个页面设置单独的 301 重定向。

我已经尝试了下面某人在 stackoverflow 上发布的建议,以及我在另一个网站上找到的建议,但都被忽略了。主机是否需要启用某些功能?我知道 rewrite.script 正在被读取,因为我将它用于搜索引擎友好的 URL。

#— 301 Redirect —

match URL into $ with ^/old.html$
if matched
set OUT:Location = http://www.yourdomain.co.uk/new.html
set OUT:Content-Type = text/html
set RESPONSE = 301
set BODY = Moved
goto END
endif

这是我的整个 rewrite.script

#Zeus webserver version of basic WordPress mod_rewrite rules
map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END
##### FIX FOR LOGIN/FORGOTTEN PASSWORD/ADMIN ETC #####
match URL into $ with ^/wp-.*$
if matched then goto END
##### FIX TO ALLOW SEARCH TO WORK #####
match URL into $ with ^/(.*)
set URL = /$1

RULE_0_START:
match URL into $ with ^\/pagename$
if not matched then goto RULE_1_END
if matched then
    set URL = http://domain.com/newpage.php
    set RESPONSE = 301
    set OUT:Location = %{URL}
    set BODY = Please try <a href="%{URL}">here</a> instead\n
goto END
RULE_0_END:
4

3 回答 3

0

也许是这样的(每个重定向一次)?

RULE_0_START:
match URL into $ with ^\/pagename$
if not matched then goto RULE_1_END
if matched then
    set URL = http://domain.com/newpage.php
    set RESPONSE = 301
    set OUT:Location = %{URL}
    set BODY = Please try <a href="%{URL}">here</a> instead\n
goto END
RULE_0_END:

您必须为每条规则增加一个规则编号。

于 2010-12-08T14:59:56.927 回答
0

为什么不使用它 - 它使它更容易......

http://seo-website-designer.com/Zeus-Server-301-Redirect-Generator

于 2012-07-26T14:24:10.067 回答
0

Zeus 支持 .htaccess 及其许多指令,包括 Redirect。请参阅此处的第 325 页:

http://support.zeus.com/ZWSUserGuide.pdf

该链接与 4.3 版有关。我不确定早期版本。

于 2014-08-29T13:24:42.733 回答