Reputation: 11780
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
".
Upvotes: 0
Views: 664
Reputation: 17688
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
Upvotes: 2
Reputation: 11780
ok thank you guys. I have written the code to check gzip of a website. Here it is...
<?php
$headers = get_headers("http://www.example.com", 1);
echo $headers['Content-Encoding'];
?>
Upvotes: 2
Reputation: 502
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:
foreach (getallheaders() as $name => $value) {
if ($name == 'Content-Encoding') {
echo 'Encoding is: ' . $value;
break;
}
}
Upvotes: 2
Reputation: 8508
htaccess is a hidden system file so you cannot access it, usually you would use phpinfo();
to look at your php settings.
Upvotes: -1