Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Bug in StaticPublisher?!


Reply


17 Posts   2505 Views

Avatar
martimiz

Forum Moderator, 1132 Posts

25 September 2009 at 8:09pm

I'd agree with socks' approach. I think you added some rule(s) to your .htaccess and removed the %{DOCUMENT_ROOT} from the homepage part. In that case you should add the absolute path to your cached files.

I only ever used StaticPublisher from a webroot install, so I don't know of any possible quircks in orther installtypes - should check that out for myself as well, to think of it.

@socks: you're right, I did change the cachedirectory name to html-cache, should have mentioned that. I remember running into some problem there, as the name 'cache' is hardcoded in the FileSystemPublisher, which led to the cache not being cleared first during /dev/buildcache/. Had to alter code for that (v232) :-(.

Avatar
Garrett

Community Member, 245 Posts

26 September 2009 at 4:52am

I've done all the above exactly as instructed and am using your version of .htaccess and.... same exact result. It's serving me the dynamic version. How exactly can I tell, though? Are the URL's going to say "*.html" or are they rewritten?

Avatar
martimiz

Forum Moderator, 1132 Posts

26 September 2009 at 6:06am

The urls will stay exactly the same - you can't tell it from there. Thing you can do to test is, as socks said, change something in one of the the html files and see if it's reflexted in the site. I'm absolutely no .htaccess expert, but:

Are you using rewriteBase /looksmart? In that case you should remove the /looksmart directory from all other rules, but not - I think - from the %{DOCUMENT_ROOT} rules, because this represents the fysical path...

So something like

RewriteCond %{DOCUMENT_ROOT}/looksmart/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/%1.html [L]

And do check if %{DOCUMENT_ROOT} is recognized...

Avatar
Garrett

Community Member, 245 Posts

26 September 2009 at 8:01am

I know now for sure that the site I am seeing is dynamic. When I edit the HTML files, the changes do not appear. Here is my code:

### SILVERSTRIPE START ###

<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /looksmart

## CACHE 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 ###

See any issues here? I also tried replacing %{DOCUMENT_ROOT} with /looksmart but that had no effect either. What am I doing wrong here?

Avatar
Garrett

Community Member, 245 Posts

26 September 2009 at 8:45am

This is interesting.

The only way I can get it to work is if I REMOVE the ## DYNAMIC CONFIG ## block entirely. I was wondering, incidentally, how those code blocks could all co-exist anyways. Was I supposed to have all three??

Anyways, so the site is being served now from cache and this has raised two New issues. #1, why do all the links get written as /looksmart/index.php/[LINK]? index.php?? This is absurd! Who would want "index.php" in their URL? For example, "http://localhost:88/looksmart/index.php/executive-team/". Ha? Why is this happening and how do I get rid of it? You've seen the same, I assume?

Issue #2 is that all the links works EXCEPT for ONE-- the BLOG. When I go to http://localhost:88/looksmart/index.php/blog/, it redirects to http://localhost:88/looksmart/blog/ and there's a directory listing! Again, some very strange behavior. Could this have something to do with the blog (code, templates, etc.) living in a separate folder in the site structure? Anyone using the blog module with StaticPublisher?

Any and all help will be geratly appreciated!

//Garrett

Avatar
socks

Community Member, 191 Posts

26 September 2009 at 1:16pm

Ah, you ARE checking on your Localhost... then I'm guessing you do need to add that section back in to the HTACCESS (Config for Dev Environments). I haven't tried to get StaticPublisher working on Localhost before but your URLs should not look like what you described.

Leave the Dynamic Config in... If one of your HTML pages gets deleted somehow, the site will serve up the dynamic page instead. I'm guessing that if you delete that part of the HTACCESS, it will no longer do that.

Once you get it working properly, then go back and check your Blog again to see if that fixed that issue.

Avatar
Garrett

Community Member, 245 Posts

29 September 2009 at 3:09am

Hi and continued thanks...

I'm kind of lost here, I gotta tell ya. What does whether I am on localhost or not have to do with anything? There are no absolute paths in this file. Also, where am I telling the webserver what kind of environment I am in? How does it know? How does the webserver Know which codeblock to use?

Avatar
Garrett

Community Member, 245 Posts

29 September 2009 at 3:16am

Once I remove /***sitedir*** from each of the paths (because I'm using RewriteBase /looksmart), there is no difference between the DEV and LIVE codeblocks so i really don't see the point of them. Help!