Categories: Joomla

Use 301 Joomla Redirect for non www to www and vice-versa

Joomla Redirect is important when you change some URL or direct http to https. Like physical addresses, your URL can change. If you change it, your frequent visitors and regular users might have a hard time finding it as the old and new addresses are separate. To avoid this, you can use 301 redirects. Simply put, a redirect will effortlessly “direct” the user (and the crawlers) to their new URL when they visit outdated URLs.

Why is “301 redirect” useful?

Suppose your website has an affiliate program, and you can find detailed information about the program at www.example.com/affiliate. But recently you changed the site structure and the permalink structure was also reorganized. Therefore, the “member” page has a new address: www.example.com/affiliate-program. As a result, because the URL has been changed, users who bookmarked the “Members” page with the old address will receive a 404 error. This awkward situation can be solved by 301 redirection. Joomla provides a built-in feature for this, called URL redirection.
It is also useful if you want to maintain site authority and SEO weight while moving the content to another page. The bot of the search engine will visit the old URL, redirect, and crawl the new page while maintaining the weight of the old URL.

Joomla 301 Redirects

Joomla uses a built-in plugin called Redirect to handle 301 redirects. You only need to follow a few simple steps to enable 301 redirects for any URL on your Joomla website.
Redirection of Joomla website can be also be done by modifying and editing the .htaccess file in the server. But many of us face problems while writing exactly the redirection code. Recently we found a website which can help us generating any .htaccess code, may it be non-www to www redirection, 301 redirection or 404 errors.
Generate Redirect Code

Joomla Redirect non www to www and www to non www

For SEO reasons, it is better to redirect your site’s url other than www to www or vice versa.
For example, when trying to access our site through https://infyways.com, you redirect to https://www.infyways.com/new.
Note the “www” in the second URL. Technically, the version without www and the www version are two different domains. So redirecting one to another improves our SEO. Google and other search engines won’t have to worry about two different domains.
This tutorial will show you how to redirect the entire Joomla website to non-www or www.

  • Open the default .htaccess file from your Joomla folder and find the following
RewriteEngine On
  • To redirect non-www to www, add the following code below it:
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]
  • To redirect non-www to www, add the following code below it:
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]

If none of the above methods work for you, please check if you are on the IIS server. If so, please try this tutorial.

Abhilash Sahoo

Abhilash Sahoo, with 14 years of experience, is a Certified Joomla and WordPress Expert and the Founder & CEO of Infyways Solutions, specializing in innovative web development solutions.

Share
Published by
Abhilash Sahoo

Recent Posts

HubSpot vs WordPress: A Comparison Overview of Popular CMSs.

HubSpot vs WordPress? What best? Indeed, for more than ten years, WordPress has been the…

3 months ago

Boost Your Website’s Performance with Expert WordPress Speed Optimization Services

WordPress Speed Optimization Services for Website maintenance is a full-time job. Apart from introducing new…

3 months ago

Fixing There Has Been A Critical Error On This Website WordPress

Nothing is more terrifying than when your WordPress website is going down, especially when you…

4 months ago

WordPress vs Ghost: Exploring the Differences!

WordPress vs Ghost, who wins actually? Despite its current position as the world's leading content…

4 months ago

Top WordPress Security Services Providers in 2023

The security and safety of any website are essential for its health and well-being. The…

4 months ago

Top 12 WordPress Website Management Tools for 2023

Let's explore the definition of WordPress Website Management Tools before moving on to the finest…

6 months ago