Creating .htaccess 301 redirection for Joomla & WordPress - instructions


Owner & Managing Director of ithelps Digital. Since 2013, he has been deeply engaged in SEO and online marketing.
In this article, I'll show you how and for what purposes you can set up 301 redirects using .htaccess and plugins in Joomla & WordPress.
- Scenario 1: Moving the entire website
- Scenario 2: The website is converted from http to https using an SSL certificate
- Scenario 3: The path is changed for a single page ("website.com/path")
- 301 redirects for Joomla and WordPress
- The simple way to set up 301 redirects in Joomla and WordPress
- Conclusion on the 301 redirect:
301 redirects using .htaccess, but also with the help of plugins, are part of the daily routine of every SEO or web design agency. The reason for this is that if we change the URL of a page in any way, we automatically lose the value it has built up through backlinks. In the case of Google, this is known as a pagerank loss.
In this article, I will show you how we can effectively avoid this problem with 301 redirects and keep the valuable link juice on our pages.
We differentiate between several scenarios. Examples of these are
- .htaccess 301 redirect due to relocation of the entire website
- .htaccess 301 redirect due to conversion from http to https
- .htaccess 301 redirect due to changing the path of a single page
Let's look at each of these scenarios in detail.
Scenario 1: Moving the entire website
The most common reasons for moving a website:
- Company/project name changes
- Joint ventures
- Sale of the company
However, expansion into new markets also often results in the need for a new domain. For example, if a .at domain was previously used and the next target is the German market. Here we have the choice of either continuing the .at domain and starting an extra website with a .de domain (watch out for duplicate content!) or switching to a .com domain.
The most important thing when switching to a completely new domain (e.g. moving from a .at domain to a .com domain) is to retain the backlinks that pointed to the old domain. If this is not observed, you will completely lose your good search engine rankings.
The following points should be noted:
- The internal links on your pages must be changed to the new domain
- Links that come from outside, i.e. backlinks, must be redirected from the old site to the new one using a 301 redirect
The first point is solved either manually or with the help of various tools. Many content management systems such as Joomla and WordPress offer plugins that greatly shorten this process.
The second point, the redirection of backlinks, is most easily solved by means of an entry in the .htaccess.
301 redirection using .htaccess when moving an entire website
With the following code, all pages of the old domain are correctly redirected to the pages of the new domain.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.olddomain\.at
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
The prerequisite for this method is that the paths of the subpages have not changed. For example, olddomain.at/about is still newdomain.com/about.
If the paths change, this must be entered individually in the .htaccess.
See scenario 3 "Only the path is changed for a single page".
A tool that simplifies the process of .htaccess redirects can be found at htaccessredirect.net.
Google also offers well thought-out help for changing URLs (URL mapping).
Google also offers a way to notify the system as soon as a website is moved:
If you've moved your site to a new domain, you can use the Change of address tool to tell Google about your new URL. We'll update our index to reflect your new URL. Changes will stay in effect for 180 days, by which time we'll have crawled and indexed the pages at your new URL. The change of address tool is safe, because only verified site owners can use it. You can check the tool at any time to see the information provided to Google about your domains.
Scenario 2: The website is converted from http to https using an SSL certificate
If an SSL certificate is added to a website, it is important to redirect all http requests to https in order to avoid duplicate content. This redirection is also solved using .htaccess.
301 redirection using .htaccess when switching from http to https
The code for the htaccess redirect looks like this:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Scenario 3: The path is changed for a single page ("website.com/path")
If we change the path of individual pages, we have no choice but to make these changes manually in the .htaccess. An entry for redirection looks like this:
redirect 301 /old-about http://www.newdomain.com/new-about
This line must be added for each changed path.
In CMS ecosystems, there are often plugins that make this process easier by providing clear input fields for these 301 redirects.
Google offers useful tips on 301 redirects in "Change page URLs with 301 redirects".
Here is the video.
After the detailed explanations, let's take a look at how we set up 301 redirects for Joomla and WordPress websites in our day-to-day work as an agency.
301 redirects for Joomla and WordPress
As previously mentioned, it can be useful to set up a website redirect using the .htaccess file.
When you install Joomla or WordPress, a so-called htaccess.txt file is created. You can find this on your root FTP server.
activate .htaccess file
With a WordPress or Joomla installation, the htaccess file is not automatically active after installation and is called "htaccess.txt". To activate this file, it simply needs to be renamed. Namely to .htaccess (the dot in front of the word htaccess is very important).
To do this, you need access to the root directory of your website on the server. You can obtain this with any FTP tool such as the free FTP client FileZilla.
If .htaccess is activated, you can make 301 redirects and other entries as described above.
However, there are also simpler ways for Joomla and WordPress.
The simple way to set up 301 redirects in Joomla and WordPress
set up 301 redirects with the Joomla Redirect Manager
A component called Redirect Manager is included in the standard Joomla installation.
Before you can use it to set up redirects, you need to make sure that 'Use URL Rewriting' is activated.
To do this, log in to your control centre and click on Open system ⇾ Configuration
Search for Use URL Rewriting and activate it.
Now you can switch to the Redirect Manager and start your first redirect.
Go to Components ⇾ Redirects.
Click on the "New" button.
In the next window, enter 1. the old address and 2. the new address and then click on "Save".
Voilà. You have created your first 301 redirect with Joomla.
Now let's look at how to do the same in WordPress
set up 301 redirection with the WordPress Redirection plugin
To set up 301 redirects with the Redirection plugin, you first need to install it. Don't worry, it's done in no time at all.
Log into your backend, click on "Plugins" on the left and then on "Install".
In the next window, enter the term "Redirection" in the search mask and then click on "Install now" for the plugin displayed.
Once the plugin has been installed, all you have to do is activate it in the plugin library ..
... and you can set up your first redirect in WordPress.
Proceed as follows:
Move the cursor over the "Tools" menu item, a submenu will open. Click on "Redirection" there.
The user interface of the tool opens. Carry out the following steps in sequence:
- Click on "Add new"
- Enter the old path in the form field provided for this purpose
- Enter the new path in the form field provided
- Click on "Add redirection"
That's it. Your first 301 redirect in WordPress is set up.
Conclusion on the 301 redirect:
Changing the URL of a website harbours a number of risks. However, if you follow this guide carefully, you can transfer a lot of your search engine rankings from the old domain and pages to the new domain and pages.
I've shown you how to set up 301 redirects using .htaccess and how to implement 301 redirects of individual pages in Joomla and WordPress using the Joomla Redirect Manager and the WP plugin Redirection.
If you need support because you have lost your rankings due to missing redirects or because you want to make sure that you don't lose your rankings in the run-up to a domain change or a switch from http to https, contact us at
Any questions?
If you have any further questions on the topic or would like professional support, feel free to get in touch with us. Send an email to office@ithelps-digital.com, call us at +43 1 353 2 353, or reach out for us on our contact page.