rewrite.script

WordPress Permalink Problems on Register365 Zeus Hosting

A quick post to alert those of you to a small issue with Register365 Linux Zeus Hosting and WordPress. Seemingly while they support the .htaccess files traditionally used to contain the rewrite/permalink rules for wordpress, a lot of the server mod_rewrite functionality doesn’t work and you get the unnecessary “index.php” in every url before the pretty part. Here’s what you need to do to get fully pretty permalinks using the /%postname%/ setting in Settings – Permalinks.

Create a new file called “rewrite.script” with a html editor or notepad. Add the code below, save then upload the file to the root folder of your wordpress installation. Delete any .htaccess file already there.

Next go to Settings – Permalinks in your wordpress admin and choose “Custom Structure” then add just /%postname%/ to the field, ie – delete /index.php if it’s there.

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:

PS – if you have wordpress installed in a sub folder then adjust the following line from above to reflect the proper path:

set URL = WORDPRESS-FOLDER/index.php?q=%{SCRATCH:REQUEST_URI}
Advertisements

Published by

Leon Quinn

Multimedia Design company in Leitrim, Ireland specializing in WordPress Website Design, Photoshop and Graphics. www.reverbstudios.ie

3 thoughts on “WordPress Permalink Problems on Register365 Zeus Hosting”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s