Creating a 301 redirect
Permalink
Please can someone help me? I need to permanently redirect a number of old URLs to their new versions. I currently use CyberDuck as the ftp where all the files for the website are hosted.
If you could reply in lamen's terms, that would be appreciated. As I am a complete novice to coding and we no longer employ a digital agency so therefore I need to be able to understand how to do this.
The version of Concrete5 I am using is 5.4.2.2. I cannot install a newer version as there are things programmed on the website that we will not be able to update/amend if we installed a newer version.
If you could reply in lamen's terms, that would be appreciated. As I am a complete novice to coding and we no longer employ a digital agency so therefore I need to be able to understand how to do this.
The version of Concrete5 I am using is 5.4.2.2. I cannot install a newer version as there are things programmed on the website that we will not be able to update/amend if we installed a newer version.
Assuming your site is hosted on a linux server running apache:
You can add all of your redirects to the .htaccess file located in the public_html directory on your server. When you connect via ftp, enter the "public_html" directory and you should see a file named ".htaccess". If you do not see one there you can create a new text file and save it as ".htaccess"
Then add redirects by listing them in the .htaccess file, one per line, in this format:
(Note that these are case-sensitive, so example.com/page2 is NOT the same as example.com/PAGE2)
Redirect 301 /oldpath /newpath
where 301 indicates a permanent redirect.
So to redirect http://www.example.com/page1 to http://www.example.com/page2, you would add a line:
Redirect 301 http://www.example.com/page1 http://www.example.com/page2
If you're redirecting to a page within the same domain (e.g. example.com) you may also use relative paths, like this:
Redirect 301 /page1 /page2
Then save .htaccess and test your redirect. If anything goes wrong just undo your edits and save the file, or just delete it if there's nothing else there.
Sometimes you may want to use a rewrite rule instead of a redirect to catch multiple files or specific strings, and knowledgeable users can use Regex to add more flexible rules, but in my understanding this is the simplest way to get going with redirects.