Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




500 Server Error / Conflict with W3TC

UserPost

8:16 am
May 27, 2011


jonahcoyote

Member

posts 18

1

Hi there,

I keep having trouble with a site where it seems like almost every day the .htaccess is rewritten and the rules get screwed up. I've got W3TC installed for performance and it looks like Role Scoper is inserting rules into the wrong place in the .htaccess. Here is where I found the most recent rules:


<IfModule mod_expires.c>

    ExpiresActive On

    ExpiresByType text/css A3600

    ExpiresByType application/x-javascript A3600

    ExpiresByType text/html A3600

    ExpiresByType text/richtext A3600

    ExpiresByType image/svg+xml A3600

    ExpiresByType text/plain A3600

    ExpiresByType text/xsd A3600

    ExpiresByType text/xsl A3600

    ExpiresByType text/xml A3600

    ExpiresByType video/asf A31536000


# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]


# BEGIN Role Scoper

RewriteEngine On


RewriteCond %{HTTP:Authorization} ^(.*)

RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]


# END Role Scoper


</IfModule>


# END WordPress

       Header append Vary User-Agent env=!dont-vary

    </IfModule>

And then at the bottom I have Wordpress's and Role Scoper's added where they were before. So not only are the duplicated, but they are also being added in the wrong place.

Also, I've got some rules added for php memory limits on the server and these seem to get wiped out every day too. Does Role Scoper rewrite rules every day or does it occur when something happens on the site or in the admin? Can this be turned off if the configuration is set and doesn't need new rules?

Is there a way to prevent this conflict with W3TC?

Thanks,

Jonah

8:27 am
May 27, 2011


Kevin

Admin

posts 2503

2

Is this a Multisite installation?

8:37 am
May 27, 2011


jonahcoyote

Member

posts 18

3

No, not a Multisite. Running WP 3.1.3

9:01 am
May 27, 2011


Kevin

Admin

posts 2503

4

can you give me your basic W3TC settings?

9:05 am
May 27, 2011


jonahcoyote

Member

posts 18

5

Yep, heres my export php:

http://pastebin.com/ntP6s8i6


9:13 am
May 27, 2011


Kevin

Admin

posts 2503

6

I'm wondering if the problem is that you started with manually inserted W3TC rules lacking begin/end comment markers:

# BEGIN W3TC Page Cache core # END W3TC Page Cache core

…etc.

9:16 am
May 27, 2011


Kevin

Admin

posts 2503

7

That pastebin of the full W3TC config file is certainly exhaustive (and may come in handy) but to help me quickly match up my test configuration, can you do a screen capture of your W3TC settings form… or just list your General Settings?

9:22 am
May 27, 2011


jonahcoyote

Member

posts 18

8

Sure, and to reply to your previous post, I did not enter the rules manually. They were all auto generated by W3TC.

For reference here's the current working .htaccess:

http://pastebin.com/a8WP0wFM

And here's a screenshot of the General settings:

http://awesomescreenshot.com/081ds3yc5

I've only got Page cacheing and Browser cacheing enabled.

9:28 am
May 27, 2011


Kevin

Admin

posts 2503

9

What W3TC version is that?

10:32 am
May 27, 2011


jonahcoyote

Member

posts 18

10

W3TC 0.9.1.3

12:41 pm
May 27, 2011


Kevin

Admin

posts 2503

11

I think I've located the cause of this. Can you try the updated Role Scoper development code (1.3.40-dev)?

1:43 pm
May 27, 2011


jonahcoyote

Member

posts 18

12

Awesome. Got it installed. Will probably be a day or two before I know for sure if its still a problem.

Thanks for your help!

Jonah

9:27 am
May 29, 2011


jonahcoyote

Member

posts 18

13

There's still problems. The site went down again yesterday. Here is what the broken .htaccess looks like:

# BEGIN W3TC Browser Cache

<IfModule mod_mime.c>

    AddType text/css .css

    AddType application/x-javascript .js

    AddType text/html .html .htm

    AddType text/richtext .rtf .rtx

    AddType image/svg+xml .svg .svgz

    AddType text/plain .txt

    AddType text/xsd .xsd

    AddType text/xsl .xsl

<Files *.png>

    <IfModule mod_headers.c>

        Header append Cache-Control private

    </IfModule>

</Files>

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>


# BEGIN Role Scoper

<IfModule mod_rewrite.c>

RewriteEngine On


RewriteCond %{HTTP:Authorization} ^(.*)

RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

</IfModule>


# END Role Scoper

# END WordPres

A big chunk of the W3TC rules were removed and most importantly the php memory rules that the site relies on to run were removed.

Any ideas?



8:26 am
May 30, 2011


Kevin

Admin

posts 2503

14

It looks like RS was getting into a race condition with W3TC to update .htaccess. More specifically, when its rules need to be updated, RS calls $wp_rewrite->flush_rules(true). Even though that is done at the WP 'shutdown' action, W3TC's .htaccess file manipulation is apparantly still in progress. Since neither WP nor W3TC use flock for that file operation, I don't have a clean way to determine when .htaccess is being written by another process. So I've added a 2 second sleep prior to the flush_rules call.

If you're wondering about the conditions for RS to call for $wp_rewrite->flush_rules(true):

  • on plugin (de)activation
  • the first time a MS site has an attachment to a private/restricted page
  • on various plugin option changes

This change is in the updated Role Scoper development code (1.3.40-dev).

7:37 am
May 31, 2011


jonahcoyote

Member

posts 18

15

Hi Kevin, so far so good. I installed this yesterday and the site is still up today. I de-activated and re-activated Role Scoper yesterday after applying this update and the .htaccess was still intact. I'll let you know if I have any more problems.

Thanks,

Jonah


About the Agapetry forum

Currently Online:

19 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1245

Posts: 5653

Members:

There are 1255 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin