Joomla
Use 301 Joomla Redirect for non www to www and vice-versa
Written by Abhilash Sahoo•Updated on October 10, 2020•3 min read
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 CodeJoomla 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.wp.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.