I normally don’t take up such tasks, but I was recently tasked to migrate an old WordPress installation to a new server and a new version. This sounded like a pretty simple task to do, so I took it up. Upload the files, export data from the old one, import into new one and thats it! Well, thats what I thought until I found out that the new server was not running Apache. Instead, it was running Zeus webserver. WordPress uses .htaccess (mod_rewrite module) to build pretty looking URL’s (without the index.php in the URL) and unfortunately, just copying the Apache .htacess to a Zeus webserver won’t work. Took me over an hour to figure that out!

Finally, after a while of googling about this, the .htacess that looks like this :-


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

now looks like this on Zeus webserver(the file should be called rewrite.script and placed on the root of your web just like .htaccess)


RULE_0_START:
# get the document root
map path into SCRATCH:DOCROOT from /
# initialize our variables
set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}

# see if theres any queries in our URL
match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:

RULE_1_START:
# prepare to search for file, rewrite if its not found
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

# check to see if the file requested is an actual file or
# a directory with possibly an index.  don't rewrite if so
look for file at %{SCRATCH:REQUEST_FILENAME}
if not exists then
look for dir at %{SCRATCH:REQUEST_FILENAME}
if not exists then
set URL = /index.php?q=%{SCRATCH:REQUEST_URI}
goto QSA_RULE_START
endif
endif

# if we made it here then its a file or dir and no rewrite
goto END
RULE_1_END:

QSA_RULE_START:
# append the query string if there was one originally
# the same as [QSA,L] for apache
match SCRATCH:ORIG_URL into % with \?(.*)$
if matched then
set URL = %{URL}&%{SCRATCH:QUERY_STRING}
endif
goto END
QSA_RULE_END:

I must say that is a lot of code in comparison to .htacess. This is the URL I found this info on.

Finally, I got this working and all is well that ends well.