301 redirects with Joomla htaccess
From time to time you may need to make your own custom 301 redirects in Joomla.
Recently I had to redirect some .asp files of an old web site to a new Joomla site. The best way to do this is through .htaccess.
.htaccess 301 redirects for Joomla
Usually, a 301 redirect is quite a simple matter - the code below should do the trick:
Redirect 301 /oldpage.html http://www.example.com/newpage.html
However, Joomla's use of .htaccess blocks this method. After a lot of searching I found out how to do a 301 redirect using Joomla's .htaccess.
To redirect mysite.com.au/subfolder/oldpage.asp to mysite.com.au/new-page.html - do the following:
RewriteRule ^subfolder\/oldpage\.asp$ "http://www.mysite.com.au/new-page.html" [R=301,L]
To simply redirect one page:
RewriteRule ^index\.asp$ "http://www.mysite.com.au/index.php" [R=301,L]
Redirecting a folder:
RewriteRule ^languages\?$ "http://www.mysite.com.au/languages.html" [R=301,L]
Thanks to g1smd from Freeuk for additional info.