For anybody familiar with BigCommerce, I'm sure you already know whether GZIP compression is possible to configure or not on the platform. I minified my JS files and instead of them pointing to the CDN, they're looking straight to the local files because this is the only way it will update the files.
Now I want to enable GZIP for these files but I can't find where to do it(if it's even possible).
Thank you for anybody who takes the time to offer an answer!
After some further research, you actually do not have access to the .htaccess file in BigCommerce. This is because BigCommerce does not run on Apache, but it actually runs on Nginx.
Not only that but .htaccess can produce security risks, which obviously is something you want to avoid using BigCommerce.
You can however add the following code to the top of all of your pages to compress PHP:
<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
Related
I am writing some php scripts that I am using for personal reasons. One thing I noticed that if I type in the directory on the browser I am able to see all files in the directory.
How can I prevent the browser from viewing any of the files in a directory? I want to be able to send requests to the server and let the server run the script. Can someone point me in the right direction? Should I configure the .htaccess file? If so, what should I be looking for?
FYI: I am on a shared hosted server.
the fast way to do that creat .htaccess ex: under /public_html/
and put this code inside it
Options -Indexes
all about .htaccess to more information
I've been developing a website on a local web server and I'm pretty happy with it. I'm about ready to deploy it but I've been looking at how to limit folder access via htaccess. My concern is I grab some php variables from a document on the web server and I'm worried that by denying htaccess ill also prevent the php file from reading and writing to this document. Is this the case? If so how would I go about setting up a hierarchy in which my php can read and write to my document but people can't access the folder that its in?
.htaccess is a means to configure a server on a per-directory basis.
If you are going to be writing files using PHP, then it is going to be doing so using the file system (unless you are using HTTP PUT or similar, but you'd know if you were), so the server configuration is irrelevant.
Apache will simply forward your requests to the PHP interpreter. Once the request is past Apache, all rewrites/folder restrictions have already been validated, which means PHP never knows about them (and it shouldn't).
Htaccess is a webserver restriction, if you can access the page, then PHP doesn't care if you have it or not, so you can fopen / edit your files from PHP without problems. Of course if you write your file to a (different) directory that is htaccess protected, the user will have to insert the password to read it
I currently have the W3 Total Cache plugin installed on my self-hosted WordPress site. The question is in regards to the behavior im experiencing with the plugin itself and its relation to the .htaccess file, which is located one-level up of my WordPress core files. I followed the WordPress Codex on moving the core files in its own sub-directory, outside of my root folder.
In any case, the plugin created a bunch of <ifModule> directives, half of which i dont recognize. Im not sure my expire headers are being respected by my CDN -— which it should. I confirmed this using YSlow and WebPageTest, both showed me that none of the files hosted by my CDN have expire headers, despite adding expire headers for all those file types within the plugins settings.
Does it have to do with the location of my .htaccess file and the WordPress core files? Any help is much appreciated.
After talking with customer support over at my CDN's live chat (small chat window, mind you.. but great support), i sort of accepted an inevitable win-lose scenario to this problem. Since all my static files are hosted with them, i used their cache control override feature to set expiry's for me (known as Over-ride Cache Control Header)
Both me and customer support tried several ways to get around W3 Total Cache's settings for caching, none of them worked. It seemed my expiry header directives in my .htaccess file set by the plugin weren't being respected, but all other directives were working fine.
UPDATE: After much research, i found out that my hosting provider doesn't offer mod_expires on shared hosting, it's only available on Virtual Dedicated Server's.
Am trying to override the default php.ini configuration using .htaccess / ini_set, but the configurations are not getting reflected while executing the script. Here the PHP is installed as fastcgi and am in a shared hosting account. Is there any way to change the php.ini settings or I need to upgrade my account to virtual dedicated server. Please help in this regard.
Thanks for your answers,
to be more elaborate, i want to change the max_execution_time of my php script as am handling with a huge log file need to be parsed. This script exceeds the default configuration in php.in (i.e) 30 secs. As my site is in the shared hosting, am not able to configure it in php.ini, they given a (php.ini)file in the document root ans ask us to configure the values but that is not reflecting.I tried the dynamic way using ini_set, same result.
The include path is .:/usr/local/php5/lib/php
I doubt you will be able to modify everything in the php.ini file on a shared host. The host could've turned the whole ini_set() function off for all I know! A virtual dedicated server might be what you're looking for (I have never encountered this stuff, as I run my own servers).
Just wondering, what are you trying to set?
Try to create a new php.ini file in the directory from where you are executing your script with your required php.ini environment variables.. Also, if it's cPanel hosting that you are using.. there's one more setting that you need to change in the cPanel.. you might be allowed access to turn this setting on or off depending on your web host. I'll post the setting in a moment.. Please confirm if you use cPanel hosting?
For most shared hosting environments, having a copy of php.ini file in your public_html directory works to override the system default settings. A great way to do this is by copying the hosting company's copy. Put this in a file, say copyini.php
<?php
system("cp /path/to/php/conf/file/php.ini /home/yourusername/public_html/php.ini");
?>
Get /path/to/php/conf/file/php.ini from the output of phpinfo(); in a file. Then in your ini file, make your amendments
Delete all files created during this process (Apart from php.ini of course :-) )
what is htaccess file? how to create and write that? what is the advantage of using htaccess file?
.htaccess files provide a way to make configuration changes on a per-directory basis. See the official Apache documentation for .htaccess files.
.htaccess allows you to override Apache's (and other servers') main configuration file for a particular directory (and all its subdirectories). To use .htaccess you simply create a new file and name it ".htaccess" (yes, the name is very unusual because it actually consist of only a very long file extension), upload it to you server (if you want to affect your entire site than put is in your root folder), and finally add some directives.
If you wand to see what sort of things you can configure with .htaccess check out this very accessible tutorial: 5 most useful applications of the .htaccess file.
For something more comprehensive visit guide .htaccess.
Hope this helps
This is majorly used for configuration on server the generally things involve in usage are following.
-(redirecting server to specific file)
Redirect permanent /index.html (new path)
For more you can refer to http://httpd.apache.org/docs/2.0/howto/htaccess.html#related