• Resolved Stephen Ekpa

    (@droidafrica)


    Hi…
    When Gzip is activated, the following code is added to .htaccess

    
    # BEGIN WP-Optimize Gzip compression
    <IfModule mod_filter.c>
    	<IfModule mod_deflate.c>
    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    		AddType application/vnd.ms-fontobject .eot
    		AddType font/ttf .ttf
    		AddType font/otf .otf
    		AddType font/x-woff .woff
    		AddType image/svg+xml .svg
    		
    		AddOutputFilterByType DEFLATE application/javascript
    		AddOutputFilterByType DEFLATE application/rss+xml
    		AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    		AddOutputFilterByType DEFLATE application/x-font
    		AddOutputFilterByType DEFLATE application/x-font-opentype
    		AddOutputFilterByType DEFLATE application/x-font-otf
    		AddOutputFilterByType DEFLATE application/x-font-truetype
    		AddOutputFilterByType DEFLATE application/x-font-ttf
    		AddOutputFilterByType DEFLATE application/x-font-woff
    		AddOutputFilterByType DEFLATE application/x-javascript
    		AddOutputFilterByType DEFLATE application/xhtml+xml
    		AddOutputFilterByType DEFLATE application/xml
    		AddOutputFilterByType DEFLATE font/opentype
    		AddOutputFilterByType DEFLATE font/otf
    		AddOutputFilterByType DEFLATE font/ttf
    		AddOutputFilterByType DEFLATE font/woff
    		AddOutputFilterByType DEFLATE image/svg+xml
    		AddOutputFilterByType DEFLATE image/x-icon
    		AddOutputFilterByType DEFLATE text/css
    		AddOutputFilterByType DEFLATE text/html
    		AddOutputFilterByType DEFLATE text/javascript
    		AddOutputFilterByType DEFLATE text/plain
    		AddOutputFilterByType DEFLATE text/xml
    		
    # Remove browser bugs (only needed for really old browsers)
    		BrowserMatch ^Mozilla/4 gzip-only-text/html
    		BrowserMatch ^Mozilla/4\.0[678] no-gzip
    		BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    		Header append Vary User-Agent
    	</IfModule>
    </IfModule>
    # END WP-Optimize Gzip compression

    This code leads to error 500 instantly, unless removed.
    What is the issue?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Harshad

    (@bornforphp)

    @droidafrica The rules looks good, do you have any other rules inside your .htaccess besides default WordPress rules, if yes can you please remove other rules and keep only default WordPress rules and WP-optimize rules and check if it works?

    Thread Starter Stephen Ekpa

    (@droidafrica)

    Thanks for the reply @bornforphp
    Just to avoid back and fort communication, I have included the the other content of my .htaccess

    # BEGIN iThemes Security - Do not modify or remove this line
    # iThemes Security Config Details: 2
    	# Pass through Authorization header.
    	<IfModule mod_rewrite.c>
    		RewriteEngine On
    		RewriteCond %{HTTP:Authorization} ^(.*)
    		RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
    	</IfModule>
    
    	# Ban Hosts - Security > Settings > Banned Users
    	SetEnvIF REMOTE_ADDR "^2a01:0?e0a:0?4e0:bce0:dd24:fcac:4a4a:6cc3$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^2a01:0?e0a:0?4e0:bce0:dd24:fcac:4a4a:6cc3$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^2a01:0?e0a:0?4e0:bce0:dd24:fcac:4a4a:6cc3$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^2a01:0?e0a:0?4e0:bce0:8c94:6c6c:6bfc:0?dba$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^2a01:0?e0a:0?4e0:bce0:8c94:6c6c:6bfc:0?dba$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^2a01:0?e0a:0?4e0:bce0:8c94:6c6c:6bfc:0?dba$" DenyAccess
    
    	<IfModule mod_authz_core.c>
    		<RequireAll>
    			Require all granted
    			Require not env DenyAccess
    			Require not ip 2a01:e0a:4e0:bce0:dd24:fcac:4a4a:6cc3
    			Require not ip 2a01:e0a:4e0:bce0:8c94:6c6c:6bfc:dba
    		</RequireAll>
    	</IfModule>
    	<IfModule !mod_authz_core.c>
    		Order allow,deny
    		Allow from all
    		Deny from env=DenyAccess
    		Deny from 2a01:e0a:4e0:bce0:dd24:fcac:4a4a:6cc3
    		Deny from 2a01:e0a:4e0:bce0:8c94:6c6c:6bfc:dba
    	</IfModule>
    # END iThemes Security - Do not modify or remove this line
    
    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    As you can see, aside WP default, the other code in the .htaccess is generated by iTheme security plugin.
    Thanks for reviewing

    Harshad

    (@bornforphp)

    @droidafrica Can you please keep only default WordPress rules and remove iThemes rules and then try to click Gzip and check if it works?

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    Thread Starter Stephen Ekpa

    (@droidafrica)

    I just did this, but still got same server error 500

    Harshad

    (@bornforphp)

    @droidafrica

    Could you send me a copy of your server’s Apache log?
    If you are unsure where to find the PHP Error log, you can ask your hosts to provide it.

    Can you also share your Site url?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘GZip leading to Error 500’ is closed to new replies.