OpenCms
knowledge base

Creating URL redirects

1. URL redirects are useful when an expired link needs to route to a new location.

2. We will do a redirect on the following example URL to another location on the same site:

Example URL

3. To create a redirect, first recreate the folder structure leading up to the HTML file:

Folder portion of URL

The above folder structure consists of a tea folder within an overall beverages folder:

Folder structure in OpenCms

Here are the steps on folder creation: 

a. To create a folder, press New (new) in the Explorer Menu at the top. 

b. From the next screen, select Folder and press Continue.
Create folder in OpenCms
c. Next, type the name of the folder in lower case (eg. beverages) and press Continue.
Name the beverages folderd. Give the folder a Title (eg. Beverages), make sure it is not added to the site navigation and press Finish.
Add the folder title

4. Once an identical folder structure has been created in OpenCms, generate a redirect file on the .html portion of the link:

Redirect portion of URL5. To do so, open the newly created folder structure (eg. beverages > tea) and press New (new) in the Explorer Menu at the top. 

6. From the next screen, select HTML Redirect:

Create HTML redirect

7. Give the redirect file a name that is identical to the  .html portion of the URL above and press Continue:

Redirect file

8. In the next screen, enter a descriptive Title (for your reference) and make sure that Add to navigation is unticked. Then press Finish.

Redirect file properties

9. Next, edit the file you have just created to embed the new link destination:

Editing the redirect file in OpenCms

10. In the editor, hover over the OpenCms icon on the right and press the green Add New button:

Add new URL

11. Next, press the folder icon (Folder icon) on the right to open the site navigation structure. Then click on the new file you wish to redirect to (expand the relevant folders in the pop up and then click on the final destination file). Once the new link has been embedded, select Permanent as the redirect type:

Creating a permanent redirect

12. Lastly, press Save and close (Save and close button) at the top. Publish (Publish changes) changes and test the URL redirect in a new window. 

Next page: Removing pages