2

I have a site hosted on Godaddy, I need to enable gzip compression on my website as it recommended on speed test, and I have added below content to .htaccess

# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP

My final htaccess look like

# 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 GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP

But when I load my website and open the .htaccess file again the file content becomes as reset to initial, like,

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

My godaddy hosting plan is Deluxe Classic Hosting Linux.

Edit:

I got it working by stopping all system process on godaddy, then edit again the .htaccess file resolved the issue.

But this was for short time, after few minutes the .htaccss file revert to it's original content.

Can any one give what can be the issue?

1
  • I don't know, but it kind of sounds like a (WordPress?) "security" plugin of some kind is perhaps reverting the file back to a previous version (ie. blocking changes)?! What file permissions are set for the .htaccess file?
    – MrWhite
    Commented Apr 18, 2015 at 15:07

1 Answer 1

2

GoDaddy by default enables mod_deflate and globally sets the compression types on all packages purchased in the last few years. Only classic accounts require manual intervention.

SOURCE

Our Linux Web Hosting hosting accounts have mod_deflate enabled by default. This compresses all text type files requested from it. You can disable mod_deflate on a per-directory basis and it applies recursively. You can place the following in a .htaccess file to disable mod_deflate:

SetEnvIf Request_URI .* no-gzip=1

Classic

Our Classic Hosting accounts do not enable mod_deflate at the global level, but you can enable it in your .htaccess file.

It's always best practice to contact your host first, if they are no help then your with the wrong provider, also just so you know, not all hosts require <IfModule>, so if you are on a classic account remove the <ifmodule mod_deflate.c> as GoDaddy does not mention it.

7
  • Hi, thanks for the reply. I have already contacted them, they said first stop system process then change the permission of file .htaccess to read/write/execute and edit it and I got 33/100 on speed test. It worked for short time, I have tested it with Google PageSpeed Insights got the result Desktop: 71 / 100(previously it was 33/100). After a few minute the .htaccess file revert back to it's initial content. My question is does apache doing this or some background process from web hosting service ? Do you have any idea?
    – Haris
    Commented Apr 18, 2015 at 14:38
  • It would be helpful to include a screenshot of the pagespeed insight, also make a phpinfo file without the module in .htaccess Commented Apr 18, 2015 at 14:58
  • Here the link of my website sealindustry.com can you please check it directly. and I didn’t get the point make a phpinfo file without the module in .htaccess
    – Haris
    Commented Apr 18, 2015 at 15:02
  • Hey Haris, I can do but phpinfo your need to do yourself, since it requires you to upload or create a file on your server. Simply create a file called whateveryouwant.php containing just <?php phpinfo(); ?> then look at the modules. Don't disclose the url path of the php info or delete it once looked. Commented Apr 18, 2015 at 15:04
  • By the way the top of your template you have strange characters �٥ Your need to remove them. Commented Apr 18, 2015 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.