Zeus Server – WordPress Remove index.php In Permalinks And Image Rendering Problems

, , , , , , , ,
Geek post.

WordPress is great. It now powers around 19% of the web. It’s simple to use, intuitive, has fantastic theme templates and plugins, and will continue to thrive. But what happens when your web host uses a different server than Apache? I recently found out….

I was working on a site that uses Namesco (or Names.co.uk) as the host. They use Zeus servers. You get PHP and mySQL support, but that’s where the positives end. I uploaded and unzipped WordPress 3.5.2, logged into my site and then discovered two big issues;

1. Index.php is included in the permalinks

I prefer clean URLs that allows the user to understand the file structure, and where they are in the site. Clean URLs simply look better too. For some reason Zeus seems to think that plonking index.php in the middle of the URL structure is a good idea. The first problem is to remove the index.php part from the URL string.

Wordpress permalink settings

If you try selecting ‘Custom Structure‘ to correct the issue, you’ll probably end up with a Zeus server error. Problematic and annoying.

Solution

Unlike Apache, Zeus doesn’t use mod_rewrite. Instead Zeus uses a rewrite.script. It is little powerful file which needs to be created (or changed) and uploaded via. FTP to your root folder.

The code below simply tells Zeus to stop playing games and remove index.php from the URL path. Feel free to copy;


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:

2. Image thumbnails not showing in the Media Library

If you try uploading images to the WordPress Media Library, and try adding them to a post or page, you’ll notice the image thumbnail is missing, and the image doesn’t render. This has nothing to do with file size or file type (jpg, png etc.). This is simply a permission problem that needs to be corrected with your web host, in my case Names.co.uk.

Solution

Load the images as you would do normally to your WordPress Media Library. Don’t worry about the image thumbnail for now.

Log in to your web host, go to your control panel, navigate to the file manager, and go to the folder where the images are stored (usually this will be in …/wp-content/uploads/YEAR/MONTH).

Namesco web host - changing permissions for images

By default, the images are set to ‘4 – Read Only‘ for Group and Others. Check all the images you need to change the permissions for, and select the change permissions button.

Zeus server - changing images to read write

For Group and Owners, select ‘6 – Read and write‘ and click save.

Go back into WordPress and refresh. After 2 or 3 minutes the image thumbnails should now appear, and the images will be shown in the posts.

Hope that helps!

3 replies
  1. hazey_jane
    hazey_jane says:

    Thanks for this – really useful post!

    Have you since found a more permanent fix for the image permissions issue? One that doesn't require you to manually change the permissions for each new uploaded picture?

    Thanks,
    Hazel

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *