Internal vs External URL redirection

Stay updated with our latest articles:


We all have experienced URL redirection at some point in our tours of the web - when we typed a URL without www and got taken to its www version or when we visited a web page without any file extension in its URL. There are different reasons for why we need these sorts of redirection in our servers which you can read at this article.

For this article we will just look at the sorts or URL redirections i.e internal and external and how to apply both of them to the cases given above.

Internal redirection

Internal redirection also refered to by URL rewriting, is when one URL gets redirected to another one internally WITHOUT the user agent knowing of the change.

So as the name implies, internal redirection denotes some internal URL redirection process which is not seen by the browser and a user, which can be a human or a site crawling bot.

In technical terms, this type of redirection doesn't send a 301 or 302 response code to the browser and thus it doesn't know of any change and consequently doesn't even alters anything in the URL address bar.


Why do we need it?

Internal redirection is done usually to beautify URLs i.e make them look better and more readable for humans and search engines.

The following URL isn't at all readable or rememberable, is it? It is just some ugly combination of characaters!

Compared to it, the following URL is much more calm, beautiful and search engine friendly:

So we could redirect this better URL internally to the first one which is the actual file for generating the HTML page. We don't want to show our users some ugly urls in the address bar and thus employ internal URL redirection in our servers to a) show them the good URL and b) to not have to manually create new directories and files matching the good URL.

External redirection

Just as you might've thought - external redirection is the exact opposite of internal redirection.

External redirection is when one URL gets redirected to another one externally, WITH the user agent knowing of the change

In external redirection the browser and user all know that one URL was redirected to another. In technical terms, unlike internal redirection, it does send a 301 or 302 response code to the browser which consequently updates its address bar to point to the new URL.

For a search engine such response codes can mean to transfer the ranking juice of the OLD URL to the new URL i.e all the SEO significance for the old URL gets transfered to the new URL.

Now on to why do we need external redirection...

Why do we need it?

This sort of redirection is used to unify the various URLs in which a website can be served.

For example consider the following URLs:

All of them point to the same page - we can write any one of them in the browser and it will take us to the same page under that specific URL. Four different URLs for one page, isn't it crazy!

And this is where external redirection can take charge by redirecting all other URLs to ONE, single prefered URL. In the example above it could mean to redirect all non-www and non-https URLs to

This sort of unification in URLs can, in turn, also save you from canonical and duplicate URL issues which can adversely effect your search engine rankings. For more info see what are canonical and duplicate URLs.

How to

Now after covering some solid ground on what are internal and external redirections, we arrive at a point where the question arises on how to actually redirect URLs, internally or externally .

Well if you're an Apache user, you can check out how to internally redirect URLs using htaccess and how to externally redirect URLs using htaccess for both the cases respectively. Both are extremely easy to accomplish in htaccess using the strength and regexp power of the rewriting module - rewrite_mod.

Never miss an article

Follow Codeguage on either of the following channels and stay updated with every latest blog article that we publish.

Improve your web development knowledge, today!