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:
- Force your site to display as http://yoursite.com rather than http://www.yoursite.com or vice versa. (Redirecting www to non www)
- Redirecting file extensions. Ex: http://yoursite.com/about.php to http://yoursite.com/about.html
- Redirecting URL from old domain to a new domain name
- Redirecting one URL to another URL path on the same domain name
- Redirecting a dead link to an updated working URL
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
- Log into FTP
- View your site's root. Usually located in public_html. If you see folders such as "administrator", "cache", "components", etc, then you are in your Joomla! site's folder
- Find your "htaccess.txt" or ".htaccess" file and open it with an editor by right clicking it and "Open With.." a text editing program
- Add the following lines, as needed, to 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.