• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 680
  • Last Modified:

How to use Apache server .htaccess file to enable caching on shared hosting?

I have some sites on shared hosting (GoDaddy) and I want to enable caching for the images and specific files that have been used on the site.

I don't know if there is a way to see what the main configuration settings are in the httpd.conf file, so I can check on what settings i can override with the .htacess file.  I want to be able to check the main config settings, is there a way to check those settings using PHP?

More importantly, any advice on how to enable caching of specific files using an .htaccess file is much appreaciated.  I've searched the net and it's tough to find any info on caching using .htaccess.

It's really tough to work with these files on shared hosting.  Any help is much appreciated.
0
parlays
Asked:
parlays
  • 2
2 Solutions
 
John Mc HaleCommented:
Maybe i'm wrong, but in order to enable caching, you have to use LoadModule to load mod_cache, and either mod_disk_cache or mod_mem_cache or both. Since LoadModule is a server config directive, it can only be used in a server configuration context. Thus, unless you can have your shared hosting service provider to configure the web server to enable caching, I think that you are not going to be able to achieve this.
0
 
parlaysAuthor Commented:
This is quite unfortunate.  But let's say that caching is enabled on in the main configuration file.  Would I then be able to specify specific files with the .htaccess file?
0
 
John Mc HaleCommented:
I don't believe so. As far as I am aware, ALL caching directives are only valid on either a per Server or per Virtual Host basis. I'm sure that this is probably a deliberate security measure, which would prevent someone dropping a htaccess file containing some nasty caching directives into a sensitive directory of a poorly secured web server.

Sorry!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now