I am creating an SEO analyzer. One part of it is to find whether a website has gzip enabled or not.
I found that gzip can be done either by .htaccess or in apache or Nginx. So how can i find whether entered website has gzip enabled or not?
Also when i open a website like this : www.example.com/.htaccess
it is giving me a error saying “permission denied
“.
4
Answers
ok thank you guys. I have written the code to check gzip of a website. Here it is...
htaccess is a hidden system file so you cannot access it, usually you would use
phpinfo();
to look at your php settings.Try analyzing headers with
getallheaders
. Look for something like:Content-Encoding
More info here: https://en.wikipedia.org/wiki/HTTP_compression
And here is example code:
First of all:
.htaccess
should be only be accessible through the file system, for example through ftp.As for the
gzip
detection, check the response header for:Content-Encoding gzip