HomeServer Configuration and Handling

WordPress .htaccess on Zeus Server Rewrites

WordPress .htaccess on Zeus Server Rewrites
Like Tweet Pin it Share Share Email

WordPress .htaccess on zeus server rewrites (rather than Apache)

Yesterday, I got luck to transfer a WordPress website from one hosting to another.

 

The New hosting provider is http://www.names.co.uk and what I have found is it provides the web server Zeus instead of Apache as always I have worked on.

 

It is really a new experience for me as I have not worked on Zeus server before that.
Let’s discuss what is the main issue I have faced as WordPress move is not a difficult task.

 

You have to export import database and the path updates in database it’s very quick by following some simple queries.

move your wordpress site to a new domain – easy wordpress migration

And the other is just need to transfer files and need to update “wp-config.php”.

That’s it!

 

But what I have faced is, Zeus not supports mod_rewrite as this is a module for Apache servers.
So, Zeus doesn’t support .htaccess files which are required to make your site’s URLs look pretty and SEO friendly (WordPress with its Permalinks).

The file that you need to create is called rewrite.script and is Zeus equivalent to Apache’s .htaccess file.

 

Follow the below steps to work your WordPress site smoothly with permalinks.

The .htaccess File for default WordPress looks like this:

 

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

 

Zeus equivalent rewrite.script File

 

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:

 

You can also download the “rewrite.script” file by the below URL.

Download rewrite.script file

Upload “rewrite.script” file to your WordPress root folder (the same folder that contains wp-config.php).

 

If your WordPress site in installed in a sub folder, update line 27 and include the folder to the path before /index.php.

Next you will have to go into the WordPress Settings > Permalinks and save your permalink choice again. This will force WordPress to rebuild the permalinks for the site.

 

You can safely delete the .htaccess file from the remote site as it is no longer needed.

 

I think your site is working now fine but you may notice that you have index.php at the start of all your URLs.
Go to the WordPress settings > Permalinks and update that to a custom structure permalink:

/%category%/%postname%/

 

I think it all works, if you still face any issue post your comments below.