0

I am getting the following notice from Google PageSpeed:

Avoid landing page redirects

To speed up page load times for visitors of your site, remove as many landing page redirections as possible, and make any required redirections cacheable if possible.

http://site.com/blog is a non-cacheable redirect to http://site.com/blog/

The trailing slash is not present in my html files so I'm not sure why blog redirects to blog/. The actual page is here. How do I correct this?

0

One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to http://astrology.yahoo.com/astrology results in a 301 response containing a redirect to http://astrology.yahoo.com/astrology/ (notice the added trailing slash). This is fixed in Apache by using Alias or mod_rewrite, or the DirectorySlash directive if you're using Apache handlers.

http://developer.yahoo.com/performance/rules.html

You should fix this by adding the trailing slash to your links, and not by trying to fight with the server to get slashless URLs to load. As hinted at in the preceding quote, you can change Apache's DirectorySlash directive but...

Typically if a user requests a resource without a trailing slash, which points to a directory, mod_dir redirects him to the same resource, but with trailing slash for some good reasons:

  1. The user is finally requesting the canonical URL of the resource mod_autoindex works correctly. Since it doesn't emit the path in the link, it would point to the wrong path.
  2. DirectoryIndex will be evaluated only for directories requested with trailing slash.
  3. Relative URL references inside html pages will work correctly.

http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryslash

... you probably don't want to.

I don't know how your HTML is generated but presumably, since this is a WordPress site, it is generated by plugins or in your theme template files. It should be easy enough to edit those but without more code I'd just be guessing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.