How To Download A Header Image Just Once

While checking links on a client’s re-vamped web site, I noticed that the header image would be re-loaded for each page visited on the site. I’d forgotten to set the .htaccess file with an Expires Header to ensure that the images would be downloaded just one time by a site visitor.

Making the content appear quickly in front of site visitors should be a goal for all site developers. And besides, reducing the load on your server is always a good idea, don’t you think?

To cache a header image, or other images for that matter, or to make sure that files aren’t downloaded too often, use an Expires Header in your .htaccess file.

#Expire Header
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 2 months"
</FilesMatch>

Note that all types of image files, as well as stylesheets, javascript, flash and other file types, can be cached with this Expire Header.

Permalinks Totally Screwed Up When Changing From Default Structure

Permalinks are the URLs that refer to your WordPress pages, posts and categories. Essentially, the links to your blog pages and posts are permanent links or permalinks.

Each post or page created in WordPress is identified with an ID number. Default URLs use the ID number to differentiate between individual pages and posts. An example URL would be something like https://www.computeraxe.com/?p=123 for the post or page that has ID number 123.

The problem with this default permalink structure is that nobody can remember which posts the numbers represent. To make your blog URLs more meaningful you can change the permalink structure from the default structure to a more useful one.

This is a great tip for anyone interested search engine optimization for their blog.

In your admin area go to Options/Permalinks. At the top of the page you’ll see the default ID permalink style selected. Choose another style that you like and then click on Update Permalink Structure to make the changes stick. Now, if your blog is fresh out of the box and you haven’t already made posts with it, then you’re set to go.

I changed my permalinks to a custom structure like so, /%post-name%/ , and when I went back to view my site, all the posts and pages were gone!

What happened here? The server could not find my existing pages and posts because it was looking for them with the old numerical names. Instead of recreating the content, changing page names, or reverting back to the old permalink structure, there is an easier way to fix this issue.

One way to solve this problem of disappearing posts or missing pages is to make the following entry in your htaccess file in the public_html folder of your domain.

Options +Followsymlinks

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Be aware that htaccess files can exist in any directory on your site.

You want to allow the server to write to your htaccess file as updates are made to your blog. Set permissions or chmod the htaccess file to 666.