By Matt on Friday, 21 November 2014
Category: Tutorials

How To Create 301 Redirects for Joomla!

There will be cases where you need to set up a permanent redirect from an old path to a new path. It also allows search engines to know they need to update the links. I would recommend using redirects via your htaccess file rather than using the redirect manager in Joomla! unless it's only temporary.

Reasons for redirecting URL's:

Note: A website user should never notice a website redirecting. It should instantly redirect them to the new website URL.

 

Apache/Linux


Edit the .htaccess file

 

Redirect an old URL to a new URL within the same domain.

Redirect 301 /oldpath.html /newpath.html

 

Redirect a URL to a different domain.

Redirect 301 /oldPath.html http://yournewsite/path.html

 

Redirect an entire folder to a new path. (Not recommended for SEO reasons)

Redirect 301 /oldPath.html http://yournewsite.com/folder

 

Redirect an entire domain to another domain.

Redirect 301 / http://yournewsite.com

Of course you would change the path of these URL's to match your own domain name.

   

Microsoft Server/IIS


Edit the web.config file

< configuration > < location path="about.php" > < system.webServer > < httpRedirect enabled="true" destination="http://domain.com/about" httpResponseStatus="Permanent" / > < /system.webServer > < /location > < location path="blog.php" > < system.webServer > < httpRedirect enabled="true" destination="http://domain.com/blog" httpResponseStatus="Permanent" / > < /system.webServer > < /location > < /configuration >

If you need to redirect an entire directory to a new path, you can do this, assuming you are opening web.config within that directory:

< httpRedirect enabled="true" destination="http://domain.com/newdir" httpResponseStatus="Permanent" / >

That's it! Your redirection should work now.