• Call Us
  • 360.322.4907

Monday - Friday ( 09.00 - 18.00 PST )

Nov21

How To Create 301 Redirects for Joomla!

Author // Tessa Mero Categories // Tutorials

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.



apache-linux


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.

About the Author

Tessa Mero

Tessa Mero

Tessa is a web application developer for Natural Selection Web Design and a Developer Evangelist for Cisco. She's also involved with contributing to the Joomla! project on the Production Leadership Team.

Her previous experience includes working over 3 years for a large snow sports company building web applications for their manufacturing needs, helping them with communication between different engineer departments in multiple locations around the world. The also was a college instructor, teaching web application development courses.

As a hobby, she enjoys snowboarding, playing the clarinet, traveling (visited numerous countries in the last year), going to arcade centers (I have 2 young children), playing video games on the PS4, and going to Joomla/PHP conferences and meetups.

She is the organizer of the Seattle Joomla Meetup and the organizer for the Seattle PHP Meetup and has an addiction to learning new things.

Her end goal in life is to play video games full time when she retires.

(360) 322-4907