2010-12-08 132 views
1

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

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

有谁知道如何做一个基本的301重定向使用rewrite.script宙斯?相当于:

重定向301 /页面名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: 

回答

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: 

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

+0

谢谢。那么,我将/ pagename $替换为旧页面,例如/ page?52 $ – gteh 2010-12-08 15:03:30