Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn on permanent redirects (301) #48

Closed
doktorbro opened this issue Jul 12, 2014 · 12 comments
Closed

Warn on permanent redirects (301) #48

doktorbro opened this issue Jul 12, 2014 · 12 comments

Comments

@doktorbro
Copy link

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.

@doktorbro
Copy link
Author

Just found the Typhoeus boolean option followlocation. It’s what I need for external links.

Can we extend the options to internal links?

@parkr
Copy link
Contributor

parkr commented Jul 12, 2014

Make sure this is user-configurable so I can update my links which give 301's and 302's :)

@doktorbro
Copy link
Author

@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?

@parkr
Copy link
Contributor

parkr commented Jul 13, 2014

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.

@parkr
Copy link
Contributor

parkr commented Jul 13, 2014

Your heuristic of "a link to /components should be changed if components is a directory" makes sense for sure.

@doktorbro
Copy link
Author

@parkr I’ve just implemented the feature in #49. What do you think about it?

@doktorbro
Copy link
Author

@parkr This feature should work on Jekyll. This commit jekyll/jekyll@d7b5c40 is something you had done after you ran Proofer over the Jekyll docs.

@parkr
Copy link
Contributor

parkr commented Jul 13, 2014

I did that because someone (maybe you?) said you were seeing the Moved Permanently and that they were bad for SEO.

@doktorbro
Copy link
Author

@parkr Yes, it was me who proposed the change. With the new feature Proofer would do the same. Sorry for bad description.

@doktorbro
Copy link
Author

The description for Apache’s DirectorySlash option contains reasons for internal redirections.

@doktorbro
Copy link
Author

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.

@doktorbro
Copy link
Author

Done in #49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants