Zeus rewrite.script

Permalink 3 users found helpful
I have a client using a Zeus web server, anyone know how to write the .htaccess for pretty url's as a rewrite.script for Zeus?

The hosting company gives this as an example:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*\.html$ index.php
Would convert to:

match URL into $ with ^/[^/]*\.html$
if matched then set URL = /index.php

I've been playing with it but can't get it to work. I need to use this as .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Thanks

pvernaglia
 
Remo replied on at Permalink Reply
Remo
judging by the example, the regex is the same.

You did try to copy the RewriteRule line to zeus? Any error messages when you use the RewriteRule from apache?

You shouldn't include ifmodule I guess..
jaredquinn replied on at Permalink Best Answer Reply
jaredquinn
Try:

--------
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/%{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:
-----

Unfortunately I don't have access to a Zeus webserver right now, I had to struggle with this recently, so it's still kind of fresh.

cheers,
jared
pvernaglia replied on at Permalink Reply
pvernaglia
Hi I just tried that, still get a page not found error. But thanks for the suggestion.
JootecFromMars replied on at Permalink Reply
Thanks Jared. That worked perfectly for me.

To those using a zeus server, this script probably doesn't go in your .htaccess file. I think it's location may depend upon your hosting company. In my case -http://www.names.co.uk - it goes in a file in the root of my concrete5 folder named rewrite.script.
splashby replied on at Permalink Reply
splashby
I am using Namesco too and managed to get it to work with it placed in Root (Namesco = Web directory)
Thanks much Jared and Jootec much for taking the time to post.
pvernaglia replied on at Permalink Reply
pvernaglia
I went back and tried this again. there was an empty .htaccess file in the directory where c5 is installed. I deleted that and this rewrite script worked. Thanks
novelnova replied on at Permalink Reply
novelnova
I've got my rewrite.script to work except when someone types in the domain with no file name
http://www.domainname.com
rather than
www.www.domainname.com/index.html...
it gives an error 404
any ideas.

Also I can't get into the dashboard becasue it uses index.php/dashboard
any ideas?
PassionForCreative replied on at Permalink Reply
PassionForCreative
Thanks @jaredquinn for the snippet required. Also thanks to JootecFromMars for info on file name to save as. Works perfectly
lbooth replied on at Permalink Reply
lbooth
I just can't get this to work......Jared's code in a rewrite.script in the root of the web with no htaccess file, I just get the Zeus Web Server "Page not found" can someone please post a working version of there rewrite.script....?
PassionForCreative replied on at Permalink Reply
PassionForCreative
Hi Guys,

Did anyone try this with 5.5.1 yet? Upgraded the site I had this on originally and it performs properly, stripping out the index.php from the URL but it removes all the buttons from my header also. I'm not sure how to go about fixing this but the client is really adamant about the URLs being pretty, and also adamant about having the most up to date stable release.

Any help greatly appreciated.
lbooth replied on at Permalink Reply
lbooth
I've not tried it in 5.5.1 but don't think it will be any different as it's not really a problem with C5 rather the hosting, I personally I never got it sorted but client didn't really understand it anyway so I went live without Pretty URL's on....!

I did contact the host and got the below default response...

"Unfortunately, mod_rewrite is not available on our hosting packages as this is a module for Apache servers and we run Zeus. We do however, offer an alternative, more powerful rewrite facility on all of our Linux hosting packages."

"The Zeus Rewrite functionality works in a similar way but has a slightly different syntax. Simply create a file called 'rewrite.script' in your web directory and enter your rewrite rules."
pvernaglia replied on at Permalink Reply
pvernaglia
If you turn off pretty URL's the buttons are there, or are the buttons always not there since upgrading to 5.5? I had that problem when Loader::element('footer_required'); was not in the theme footer
PassionForCreative replied on at Permalink Reply
PassionForCreative
Hi guys, if I turn on Pretty URLs and upload rewrite.script the site performs properly from a user point of view - strips out index.php from the URL.

The issue is when I log in; I can't see any buttons in the C5 Edit Bar.

This morning I tried adding the Zeus rewrite script without turning on Pretty URLs and got the same issue which as you can imagine - is a bit of a pain.
lbooth replied on at Permalink Reply 1 Attachment
lbooth
I only have one demo site with 5.5 running (Not on Zeus) you should see the attached admin bar when you are logged in after the new login screen......it looks much like the older version of C5.....I take you don't have this...?
PassionForCreative replied on at Permalink Reply
PassionForCreative
I get the bar, but no buttons on it. They are all there fine when I log in without pretty Urls and the script.rewrite file but when these get added I just get a blank grey bar.
lbooth replied on at Permalink Reply
lbooth
Wish I could help more, but I've no idea what's going on....!

Can you post us a shot of the menu and what source code are you seeing in the ccm-page-controls wrapper?
westhouseit replied on at Permalink Reply
It's important that the index.php be removed when using Pretty URLs.

Open /config/site.php

Add this line to the end:
define('URL_REWRITING_ALL',true);


Here's my rewrite.script, which is modified from someone else's:

set SCRATCH:DOMAIN = medicalinvestments.co.uk
RULE_WWW_START:
match IN:Host into $ with ^medicalinvestments\.co\.uk$
if matched then
   match URL into $ with ^/(.*)$
    set OUT:Location = http://www.%{SCRATCH:DOMAIN}/$1
    set OUT:Content-Type = text/html
    set RESPONSE = 301
    set BODY = Moved
   goto END
endif
RULE_WWW_END:
RULE_INDEX_START:
match URL into $ with ^/index\.php?(.*)$
## Front end editing, etc.
PassionForCreative replied on at Permalink Reply
PassionForCreative
This works perfectly. Thanks very much. Saved me a whole heap of heartache with the client
westhouseit replied on at Permalink Reply
Small bug in my rewrite script causes problems for front-end editing. I fixed it in the code above.