5096 Posts in 1518 Topics by 1115 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2464 Views |
-
Static Publisher - .htaccess - not accessing the .html files

2 July 2009 at 6:44am
Hi everyone, I fiddled with this for a few hours now and I can't get it to work.
I followed the instructions and also read this post.
I'm testing this on a silverstripe in a subdirectory (/mydir/) of my server and the CMS per se works perfect.
So, on http://www.mysite.com/mydir/dev/buildcache?flush=1 it also builds the cache pages just fine, but I can't get the .htaccess right...This is what resides in /mydir/.htaccess:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /mydir## CONFIG FOR DEV ENVIRONMENTS
# Cached content - mydir subdirectory
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/mydir/(.*)$
RewriteCond %{REQUEST_URI} /mydir/(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/mydir/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /mydir/cache/%1.html [L]# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/mydir/?$
RewriteCond /mydir/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /mydir/cache/index.html [L]## CONFIG FOR TEST/LIVE ENVIRONMENTS
# Cached content - live webserver
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} /(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/%1.html [L]# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/index.html [L]## DYNAMIC CONFIG
# Dynamic content
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###But somehow the rewriterules never kick in. It always gives back the data from the CMS.
I know a bit about apache rewriterules and tried out a lot, patched here and there to find what's keeping it from kicking in and so on. But now i think I can't look straight at it anymore and have to ask for help
Does anybody find the general error in this .htaccess?
-
Re: Static Publisher - .htaccess - not accessing the .html files

2 July 2009 at 7:34am Last edited: 2 July 2009 7:35am
Ok, found out some more. With this it works, partially:
RewriteEngine On
#RewriteBase /mydir## CONFIG FOR DEV ENVIRONMENTS
# Cached content - mydir subdirectory
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/mydir/(.*)$
RewriteCond %{REQUEST_URI} /mydir/(.*[^/])/?$
#RewriteCond %{DOCUMENT_ROOT}/mydir/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /mydir/cache/%1.html [L]# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/mydir/?$
#RewriteCond %{DOCUMENT_ROOT}/mydir/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /mydir/cache/index.html [L]It now hits for all pages that have a corresponding "name.html" in the cache directory but since two lines are commented out it never falls back if there isn't one.
Seems that the check "-f (is regular file)" always returns False... at least on my host.
Or does anyone find an error in those two lines and me is just too stoopied?
..brain... hurts ... must ... look at ... something ... different .... -
Re: Static Publisher - .htaccess - not accessing the .html files

2 July 2009 at 8:21am
WEEEELLLLLLLL with my ISP "%{DOCUMENT_ROOT}" isn't giving back the document root, no way, Sir!
Figured it out via phpinfo(), hardhacked it into the .htaccess and voila, works like a charm.
Man, is that ISP crap, going to change tomorrow
Now for some Episodes of Spongebob to wipe my brain clear... -
Re: Static Publisher - .htaccess - not accessing the .html files

26 September 2009 at 9:08am
Hi,
When you run your site from cache-- do all the links show up with "/index.php/" in front of them?? This is really killing me. The base href is appending this for some weird reason:
<base href="http://www.mysite.com/index.php/" />
Have you see this?
Thanks,
Garrett -
Re: Static Publisher - .htaccess - not accessing the .html files

17 May 2010 at 5:06pm
Gutur I am having some similar trouble getting the static publisher to function, is there any chance you could please post up your .htaccess file so I can take a look.
My thread related to getting this working is at.
http://www.silverstripe.org/customising-the-cms/show/284249?showPost=284457
I'm on 2.4, but if your still on 2.3 it might still help.
Any help would be great
-
Re: Static Publisher - .htaccess - not accessing the .html files

17 May 2010 at 5:06pm Last edited: 17 May 2010 5:07pm
-
| 2464 Views | ||
|
Page:
1
|
Go to Top |



