Forum Moderators: phranque
Is this the correct way to update the .htaccess file?
Hy home page is index.shtml, which I tried and I tried index.html
It currently returns a 500 server header error code.
Anyone know why?
Ipowerweb is not currently expiring my changed pages automatically when I use SSI or for whatever reason, all they said is I can update the .htaccess file.
thanks,
------.htaccess file here---
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresDefault "modification plus 1 day"
<Files index.html>
Header append Cache-Control "public, must-revalidate"
</Files>
AuthName officeactivate.com
ErrorDocument 403 /v-web/errdocs/403.html
ErrorDocument 401 /v-web/errdocs/401.html
ErrorDocument 500 /v-web/errdocs/500.html
ErrorDocument 400 /v-web/errdocs/400.html
ErrorDocument 404 /error404.php
ErrorDocument 410 /error410.php
Redirect gone /example_gone_folder
Redirect 301 /web-site-design.shtml http://www.example.com/web-design.shtml
Redirect 301 /web-site-promotion-services.shtml http://www.example.com/search-engine-optimization.shtml
This is the code I added to the .htaccess file.
Now that I think about it - did I add too much?
My home page is /index.shtml the original code was index.html
### activate mod_expires
ExpiresActive On
### Expire .gif's 1 month from when they're accessed
ExpiresByType image/gif A2592000
### Expire everything else 1 day from when it's last modified
### (this uses the Alternative syntax)
ExpiresDefault "modification plus 1 day"
### Apply a Cache-Control header to index.shtml
<Files index.shtml>
Header append Cache-Control "public, must-revalidate"
</Files>
It looks like mod_expires is not loaded on your server. You will have to ask your host to enable it. If you are on a virtual private server (VPS), then they can do this easily by editing conf.d. If you are on shared hosting, it's not likely they'll be able to do it (they'd have to enable it on *all* accounts on their servers to avoid yours being a 'custom configuration' that they'd then have to remember and maintain -- not feasible for a large-scale shared-hosting operation.)
> Now that I think about it - did I add too much?
This made me smile, since I read a thread yesterday about an .htaccess file larger than 100kB...
No, your file is not 'too big' - the error log is quite clear on the problem.
Jim
I read that googleguy suggested to use it, so it must be important. <any comments?> Though Google does keep track I would think of a web pages age. So I don't know why they need me to tell them how old a page is...
Do you think this issue is important enought to leave this hosting company?
If so do you recommend any web hosting companies that offer drupal and wordpress and mod_expires turned on?
thanks!
Lots of companies do enable it, but ipw obviously doesn't want to (for some reason, possibly laziness).
We don't do hosting recommendations here at WebmasterWorld, due to the fact that anyone who owns a hosting company or who operates by sub-letting hosting from a larger company might post and say, "I've heard <insert their company name here> is the best!" That would take up a lot of space, and then who do you trust to tell the truth?
It's important to be able to set mod_expires so that you can be sure that your visitors are not seeing stale pages on the one hand, and to save you bandwidth on unnecessary page reloads on the other hand.
If you do change hosts, I'd suggest you use the "Expires After" syntax, so that pages are expired a certain period of time after they are last loaded from your server. Otherwise, if you specify an absolute date, then pages will be unconditonally reloaded from your server every time they are requested after that date, foregoing any of the considerable speed and bandwidth-saving advantages that caching offers.
Jim
Let me see if I get this code straight.
### activate mod_expires
ExpiresActive On
### Expire .gif's 1 month from when they're accessed
ExpiresByType image/gif A2592000
### Expire everything else 1 day from when it's last modified
### (this uses the Alternative syntax)
ExpiresDefault "modification plus 1 day"
### Apply a Cache-Control header to index.shtml
<Files index.shtml>
Header append Cache-Control "public, must-revalidate"
</Files>
Explanation:
1.The ### are comment lines and do not affect anything.
i.e. I can post this entire code in the .htaccess file without any ill effects
2. The line: " ExpiresByType image/gif A2592000 " expires after 1 month any .gif file (I could substitute any file type here)
3. The line: " ExpiresDefault "modification plus 1 day" " means all files are expired 1 day from now. This is the default expiration setting to use if nothing is specifically set - like gif and index.shtml
4. These 3 lines:
<Files index.shtml>
Header append Cache-Control "public, must-revalidate"
</Files>
have the effect that the file "index.shtml" must always be revalidated every time someone crawls to it.
Have I got that right? I take it that you are suggesting to remove these last 3 lines for index.shtml then?
Thanks again.
I used the same .htaccess code as above - even the last 3 lines of it for index.shtml.
When I use this tool ( [web-caching.com...] ) to check the index.shtml as set above and another page (about-us.shtml) I seem to get the same type of message for both pages that you see below.
This is the message for about-us.shtml - Is this OK? Does it have to validate? Thanks.
http://www.example.com/about-us.shtml
Date Thu, 20 Apr 2006 01:45:15 GMT
Expires 5 weeks 6 days ago (Thu, 09 Mar 2006 01:48:28 GMT)
Cache-Control max-age=-3628607
Last-Modified -
ETag -
Content-Length - (actual size: 6107)
Server Apache/1.3.34 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a PHP-CGI/0.1b
This object has been deliberately marked stale. It doesn't have a validator present. It doesn't have a Content-Length header present, so it can't be used in a HTTP/1.0 persistent connection. The clock on this Web server appears to be set incorrectly; this can cause problems when calculating freshness.