Closed doktorbro closed 10 years ago
Just found the Typhoeus boolean option followlocation
. It’s what I need for external links.
Can we extend the options to internal links?
Make sure this is user-configurable so I can update my links which give 301's and 302's :)
@parkr There are no real 301s and 302s for internal links, while we have static files sitting in the filesystem. There is no server here. I assume, that a link to /components
means a permanent redirection to /components/
if components
is a directory. How would you distinguish a 301 from a 302 without a server?
301 and a 302 are HTTP response codes so without an HTTP connection, they're meaningless. So we'd have to spin up a local server.
Your heuristic of "a link to /components
should be changed if components
is a directory" makes sense for sure.
@parkr I’ve just implemented the feature in #49. What do you think about it?
@parkr This feature should work on Jekyll. This commit https://github.com/jekyll/jekyll/commit/d7b5c40901a8657fb5fdf06bbacd7a1059d0aba6 is something you had done after you ran Proofer over the Jekyll docs.
I did that because someone (maybe you?) said you were seeing the Moved Permanently and that they were bad for SEO.
@parkr Yes, it was me who proposed the change. With the new feature Proofer would do the same. Sorry for bad description.
The description for Apache’s DirectorySlash
option contains reasons for internal redirections.
Another citation from Yahoo’s Best Practices for Speeding Up Your Web Site:
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.
Done in #49.
Over the time external links get moved permanently, because nice guys don’t break the web. In most cases that means “the old url is deprecated, use the new url”. Can we have an option to output a warning on those links?There is another case: automatic server-side redirection, when people forget to add a trailing slash in their internal links. An example is Bootstrap’s main menu: they just list the lazy
/components
instead of the right/components/
. This causes a performance waste.