Say you have 10 different versions of the same image, like your feedburner count. Here is some sweet htaccess rewriterules and caching directives you can use to show a different version based on the time.
RewriteEngine On
RewriteBase /
RewriteCond %{TIME_SEC} ^.([0-9]) [NC]
RewriteRule ^feed\.gif$ /feed%1.gif [NC,L]
RewriteEngine On
RewriteBase /
RewriteRule !\.gif - [S=4]
RewriteCond %{TIME_SEC} ^(0|4|8|12|16|22|26|30|34|38|42|46|50|54|58)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^feed\.gif$ /zi/feed1.gif [S=3]
RewriteCond %{TIME_SEC} ^(1|5|9|13|17|23|27|31|35|39|43|47|51|55|59)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^feed\.gif$ /zi/feed2.gif [S=2]
RewriteCond %{TIME_SEC} ^(2|6|10|14|18|24|28|32|36|40|44|48|52|56|60)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^feed\.gif$ /zi/feed3.gif [S=1]
RewriteCond %{TIME_SEC} ^(3|7|11|15|19|25|29|33|37|41|45|49|53|57)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^feed\.gif$ /zi/feed4.gif
In order for the image to be reloaded on each page-view of the site, I set up some anti-caching headers in my .htaccess file. First I unset the far-future Expires headers that I normally send with images, and then I instruct browsers to check the image every request to see if it has been modified.
Header unset Expires Header unset Last-Modified FileETag None Header set Cache-Control "no-cache, must-revalidate"
Awesome! You can read the full article here:
Rewriting Feedburner Counter, Cache, and more with htaccess rewrite..
htaccess rewrite code explanation
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
ErrorDocument 404 /index.php?error=404
The simple question is, can someone please explain exactly what that code does?
Says that all the rewriting will start from the directory the .htaccess file is located in
Continues to next rewritecond if the requested file does not exist
Continues to rewriterule if the requested file is not an existing directory
Rewrites any request with 1 or more characters to /index.php, which launches wordpress and handles all redirections and what to display
If you want the mydomain2 to be handled differently, create an .htaccess file in the mydomain2 sub-directory with its own errordocument. ie.
Or, alternatively, you can turn off the wordpress htaccess rewriting for that subdirectory.