We make tools that make websites.

Forums (Archived)

The Solspace Support Forums are now CLOSED (read-only)

Check out our new support options here. Please refer to this blog post for more information.

   

Redirect not working

Rank

Total Posts: 10

Joined: Mar 27, 2012

PM

Ignore

 

The static page caching is properly creating cached files from my templates and I see the solspace static page caching information appearing in the .htaccess file (located in the main EE directory). However, in practice pages are not redirecting to those cached pages.

Things I made sure to check with no luck:
- Full url is the url (and tested to make sure those static cache pages load, however… one quirk I noticed that if you go to a cached page such as http://www.northlandchurch.net/static_page_caching/1/get_involved/index.html you will see it just constantly refreshing, possibly a related issue?)
- Folder locations are setup properly

Any ideas?

Avatar
RankRankRankRank

Total Posts: 4368

Joined: Dec 2, 2007

PM

Ignore

 

Are you expecting to see http://www.northlandchurch.net/static_page_caching/1/get_involved/index.html
in the address bar.

SPC keeps your urls the same as if it were reading from the database, only it reads the data from the html file
 
Make sense?

Hope this helps.

Regards,

Jim

Signature

“When you have eliminated the impossible, whatever remains, however improbable, must be the truth.”
Sherlock Holmes

Rank

Total Posts: 10

Joined: Mar 27, 2012

PM

Ignore

 
Jim Wyse - 27 March 2012 11:56 AM

Are you expecting to see http://www.northlandchurch.net/static_page_caching/1/get_involved/index.html
in the address bar.

Hey Jim, I knew that the server just repointed to the cached file and does it server-side. Unfortunately, it’s not doing that. For example, if I remove the gzip rule generated by static page caching in .htaccess (so it only forwards to the straight index.html page) and then change the cached page for “get_involved”... when running the page you still see the EE-rendered page. It’s definitely still going through EE since it can take a few seconds for certain pages added to static page caching to render.

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

Hi miketwalker86,

Just to get this question out of the way, but you’re not trying to cache the homepage, is that correct? wink
What else do you have in your .htaccess file? Is there a lot of other custom code? Are you using other third-party add-ons that affect .htaccess? Also, what kind of server are you on (Apache, IIS…)?

Thanks smile

Signature

Rank

Total Posts: 10

Joined: Mar 27, 2012

PM

Ignore

 
Nicolas Bottari - 27 March 2012 08:43 PM

Hi miketwalker86,

Just to get this question out of the way, but you’re not trying to cache the homepage, is that correct? wink
What else do you have in your .htaccess file? Is there a lot of other custom code? Are you using other third-party add-ons that affect .htaccess? Also, what kind of server are you on (Apache, IIS…)?

Thanks smile

Haha, no caching of the main page smile Didn’t want to anger the EE index.php redirect elves. Our server is Apache.

I tried removing the custom code we had in .htaccess to test it out with no change. However, the code we have in there currently (and the only code in the .htaccess file besides what is added by Static Page Caching) is:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
RewriteRule (.*) %2/$1 [L]

I don’t think any of our other modules affect .htaccess, though we do have a handful installed since our site is pretty complex. Here’s a list of the currently installed add-ons in case I may have overlooked something that could interfere:
Blacklist/Whitelist
Calendar
Channel
Code Pack
Comment
Email
Emoticon
Favorites
FBC
Freeform
Friends
jQuery
Mailing List
Member
Metaweblog API
Mountee
Playa
Query
Referrer
RSS
SafeCracker
Search
Static Page Caching
Statistics
Tag
Taggable
User
Wygwam

Thanks again!

Avatar
RankRankRankRank

Total Posts: 4368

Joined: Dec 2, 2007

PM

Ignore

 

Mike,

Can I get a CP login and ftp access so I can take a look under the hood?

Regards,

Jim

Signature

“When you have eliminated the impossible, whatever remains, however improbable, must be the truth.”
Sherlock Holmes

Rank

Total Posts: 10

Joined: Mar 27, 2012

PM

Ignore

 

I actually was able to finally find the issue (sorry for the delay in responding). I hadn’t realized we had an httpd.conf file setup that was overriding the .htaccess file.

Another, new, issue I’ve found though is that the pages cached it goes into a loop and keeps reloading the page everytime the page is loaded. I went line-by-line through the httpd.conf file of the static page caching code and tracked the culprit to be:

## Redirect to Cache File
RewriteRule ^(index.php/*)*(.*)(/*) /static_page_caching/1/$2/index.html [L]

Obviously this is the part that actually redirects to the cached file, the static_page_caching directory looks like it is properly working and there aren’t any duplicate files or anything to that effect. Any idea why the pages would be continuously refreshing like that? Thanks!

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

Glad you found a solution for actually retrieving the cached pages smile

As for the cached pages constantly reloading in a loop, does this happen on any page cached by SPC?
Are there any redirection directives in your .htaccess/httpd.conf file after the SPC code?
Is there anything else in the cached page code itself or in the template that might be triggering some kind of redirection?
Anything else in your Apache configuration that might be triggering redirection? smile

Signature

Rank

Total Posts: 10

Joined: Mar 27, 2012

PM

Ignore

 

Thank you Nicolas and guys for helping me with this. It turns out there was a conditional (in javascript of all places) that is a helper to log people in from an old custom system into EE. With the redirect it seemed to be constantly firing that, even though it should only once. I appreciate you guys bearing with me and helping me sort through the massive amount of things we have on our site. Have a great week!

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

That’s great! Glad we could put our finger on the problem smile
Those redirect directives, whether javascript or the EE {redirect=”“} tag, can be tricky sometimes.

I’ll close the thread then, but feel free to start a new thread if you run into other issues wink

Signature