开发者

301 redirects on Zeus web server

开发者 https://www.devze.com 2023-01-30 02:14 出处:网络
Unfortunately one of my clients uses Zeus web server at the hosting company he uses.I have never used it before.

Unfortunately one of my clients uses Zeus web server at the hosting company he uses. I have never used it before.

I need to set up simple 301 redirects but Zeus does not use .htaccess, it uses its own file rewrite.script

Does anyone know how to do a basic 301 redirect using rewrite.script for Zeus? the equivalent of:

redirect 301 /pagename http://domain.com/newpage.php

in .htaccess.

The actual file names have changed too so I can't just do a straight redirect of the whole domain, I need to set up individual 301 redirects for all of the 20 pages.

I've tried the suggestion posted below by someone here on stackoverflow, as well as this which I found on another website, and it's all being ignored. Does the host need to enable something? I know the rewrite.script is being read because Im using it for search engine friendly URL's.

#— 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
got开发者_C百科o END
endif

Here is my entire 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:


Maybe something like this (once for each redirect)?

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:

You have to increase the rule number by one for each rule.


Why not use this - it makes it much easier...

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


Zeus supports .htaccess and many of its directives, including Redirect. See page 325 onward here:

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

The link relates to version 4.3. I'm not sure about earlier versions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号