When a page moves or changes its URL, the old address should redirect visitors to the new one using a 301 redirect. This sends visitors to the right place instead of an error page, and tells Google to transfer the page's rankings to the new URL.
When is this needed?
- You change the URL of a page, for example from /services.html to /services.
- You rebuild your website and pages get new URLs.
- You change your domain name.
- You merge two pages into one.
In WordPress, with a plugin
The easiest option is the Redirection plugin. See how to install plugins in How to install a plugin.
- Install and activate Redirection.
- Go to Tools and then Redirection.
- Enter the old URL in the first field, for example /old-page, and the new URL in the destination field.
- Save the redirect. By default it will be a 301 redirect.
In the .htaccess file
Our web hosting supports .htaccess, so redirects work for websites that are not built with WordPress too. The file is located in public_html and can be opened in the file manager in DirectAdmin, under System Info & Files and File Manager.
Save a copy of .htaccess before making any changes. A typo can cause your entire website to show an error.
A single page:
Redirect 301 /gammal-sida https://mittforetag.se/ny-sida
The entire website to a new domain, keeping the same paths:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?gammaldoman\.se$ [NC]
RewriteRule ^(.*)$ https://nydoman.se/$1 [R=301,L]
Place your own rules before the # BEGIN WordPress line, as WordPress overwrites everything between BEGIN and END.
Tips
- Point directly to the final URL. A redirect that goes through multiple steps takes longer and may lose some of your Google rankings.
- Use 301, not 302. A 302 means the move is temporary, so Google will keep the old URL.
- Keep redirects in place for a long time — ideally several years — as old links and bookmarks will continue to be used.
Redirects in other CMS platforms
Joomla
- Go to System and Plugins, search for System - Redirect and enable it.
- Go to Components and Redirects.
- To choose a status code, open Options and enable Advanced Mode.
- Click New. Enter the old URL under Expired URL and the new one under New URL. Select status code 301.
- Set the status to Enabled and click Save & Close.
Drupal
- Install and enable the Redirect module.
- Go to Configuration, Search and metadata and URL redirects.
- Click Add redirect, enter the old path and the new URL, and select 301 Moved Permanently.
- Save.
With the module enabled, Drupal will also create a redirect automatically when you change the URL of a page.
Wix, Squarespace and Shopify
- Wix: there is a URL redirect manager under the SEO settings.
- Squarespace: redirects are added as URL Mappings under the developer settings, one per line, for example /old-page -> /new-page 301.
- Shopify: redirects are found alongside the navigation, under URL redirects. Shopify also suggests a redirect when you change the URL of a product or page.
Wix, Squarespace and Shopify run on their respective providers' own servers, not on our web hosting. Menu names may change from time to time, so check their help centre if you cannot find the setting.
Menus in Joomla and Drupal are usually the same in English. If your control panel looks different, it may be due to the version you are using.