2

Some content management systems such as WordPress and Drupal have Short URLs by default (if the webserver allows it), but at least one other --- MediaWiki, doesn't.

Before I continue with the process of trying to make my MediaWiki website to include short URLs I'd like to ask a general understanding question on the subject (because I find the MediaWiki documentation about this extremely unorganized and undidactic).

Do short URLs obligate 301 redirects?
I do understand that they always require some webserver directives but I'm just not sure if such directives must include 301 redirects or not...

1
  • Your question makes little sense to me. You could use other redirect types but why would you? Also, there is othing intrinsic requiring any redirect - Im not sure exactly how you are defining short urls but if you control the domain you could bypass redirects altogether if your platform allows it ir you use a proxy.
    – davidgo
    May 25 at 19:17
1

To your question "Do short URLs obligate 301 redirects?" The answer is no, you don't have to use 301 redirects.

Whether you need to use internal rewrites or not is another question, and the answer depends on your platform choice.

First let's get some terminology sorted:

Redirect When talking about redirects in a web context, this usually refers to the server sending the client a response saying "the content you asked for is over here". This can be permanent (301 "it's here and that's where it's going to stay"), temporary (302 "it's here but it might be where you thought it was later") or a found (307) or permanently moved, reissue the same request (308).

Rewrite When talking about rewrites in a web context, this usually refers to the server directing the request somewhere else on the server, and then sending that response back to the client. The client doesn't know anything has changed.

Both of these processes can be controlled through .htaccess settings.

Where you might then be getting slightly confused is "url shorteners" that allow you to have very short URLs (e.g. through services such as bitly or tinyurl) which do use 301 or 302 redirects to get visitors to your site.

What the mediawiki page is talking about is allowing you to have unique, meaningful URLs for your pages based on the title, instead of index.php?title=some+page+title or similar. For that you will need to set up the internal rewrites via your .htaccess file.

1

Redirects are for when you change URLs. If your site has short URLs from the very beginning, then you don't need to implement redirects with your short URLs. You only need to implement redirects to your short URLs if you had long URLs before.

Using short URLs usually involves some sort of rewrite directive in your .htaccess file. These rewrites usually implement a front controller pattern to allow your content management system to handle all the URLs and put content on the short URLs. These rewrites are not 301 redirects. They are sometimes called internal redirects because they reroute URLs to a handler internally without changing the URLs that's visible to visitors. However internal redirects aren't real redirects and I prefer to only refer to them as "rewrites" and not as "redirects".

You also don't need redirects if you want to use both short URLs and long URLs simultaneously. Rewrite rules usually make both the original URLs and the new URLs work at the same time. You then would usually take the additional steps of

  1. Configuring your site to link to the new short URLs all the time
  2. Disabling the old long URLs:
    • Redirecting the old long URLs to the new short URLs to take care of external links to the old URLs and search engine bots that know about the old URLs.
    • Alternately, you could use canonical meta tags on the old long URLs to point to the new short URLs.

If both sets of URLs are active at the same time, it forces search engines to detect the duplication between them and choose which one they want to index. Search engines will often choose the old URLs because:

  • They are older and have a longer history
  • There are more links (especially external links) to the old URLs

You won't get all the SEO and usability benefits of short clean URLs unless you implement redirects to disable the old long URLs.

8
  • Redirects are for when you change URLs. If your site has short URLs from the very beginning, then you don't need to implement redirects with your short URLs. But what if I want short URLs without redirects and wouldn't mind taking an "SEO risk" in that regard? I understand from your answer that it's still possible, somehow.
    – RAMOS
    May 26 at 3:58
  • Hello Stephen, please revise the edit I have suggested to the answer ; I have detailed in the edit summary to the best of my ability why I think the edit is helpful.
    – RAMOS
    May 26 at 3:58
  • In case some other moderator rejects the edit: webmasters.stackexchange.com/review/suggested-edits/70603
    – RAMOS
    May 26 at 4:15
  • I rejected your edit because your formatting suggestions aren't my style. Also referring to rewrites as "internal redirects" isn't wrong, it is more misleading and I prefer always saying "rewrite" as more accurate technical terminology. May 26 at 9:13
  • I added a bunch of info to the answer about using two sets of URLs simultaneously. May 26 at 9:13

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.