URL Rewrites

URL rewrites can be created to allow users to access shorter or better looking URL’s. You can create any number of rewrites via Site configuration (in the Administrator menu) and then click URL rewrites.

You can also use rewrite rules (URL’s) 1 to 20 to display specific pages after a user logs in (Site configuration, Pages and menu, Website pages) and after a user logs out.

It is also possible to create a rewrite rule for your home page / landing page if you want to redirect your home page to a different page.

For more information about the URL’s used by your XS website, please read Infradox XS URL’s explained.

  • When you create or edit a rewrite rule, you’ll have to enter a unique number (explained later), a redirect name and the target URL. The redirect is what you can use in your browser’s address bar. The URL is where that redirect will take the visitor.
    E.g. you can create a rule with a redirect politicians that will search for all photos with the keywords portrait and politician.
    This would mean that http://www.mywebsite.com/politicians will be rewritten to a URL that executes a search and loads the search results, but the address bar will still show http://www.mywebsite.com/politicians. The URL would in this case for instance be /search?s=portrait+and+politician 
  • You can create many rewrite rules, but it is recommended to use as few rules as possible. More rules means longer URL processing times.
  • URL’s may target your own website only, i.e. the target URL’s may contain website names. The target URL’s must be relative paths and must start with a forward slash (/).
  • The rewrite names may contain only letters, numbers, dashes, underscores add dots.
  • The URL’s may contain only letters and numbers and the following symbols: +-_/?& and dots. Use + instead of spaces.
  • You have to be careful not to create rewrite rules that will cause infinite loops – that will cause serious problems for your website. If you are uncertain then please do create a ticket and ask for advise first.

Rewrite rule for your home page

To display a different page then either the standard or the custom home page, create a rewrite rule with a target URL only – leave the rewrite input box empty. A warning will appear telling you that you must make sure that the target URL exists and works properly – if not, you may not be able to access your website.

Rewrite rule for HTTP error 404 – Page not found

If the requested page can not be found then the request is redirected to the URL /404. Because this URL doesn’t exist either, the standard HTTP error page will load. If you want to display your own page instead, then create a new rewrite rule and enter 404 in the rewrite input box. In the URL input box, enter the URL to the page that you want to display.

For example, to display the home page if someone tries to load a page that doesn’t exist, use the URL /home for your 404 rewrite.
To redirect to a custom page you can for instance use the URL /c/0/4090/mycustom404page.html et cetera.

Some rewrite examples

Have a look at the following examples that explain how you can make use of this function.

Example 1

You have uploaded a html page with the file name “subject-wants-list.html” via Site configuration > Website files > HTML pages.
Pages that are uploaded this way are stored in /siteowner/html so you can display your page in a browser with e.g. the URL www.mywebsite.com/siteowner/html/subject-wants-list.html.

You want this page to be loaded with the URL www.mywebsite.com/wants-list

Add a rule, give it a unique number and enter wants-list in the rewrite input box. Next enter /siteowner/html/subject-wants-list.html  (without your website name and starting with a forward slash always) and click save to add your new rewrite rule. The name that you have entered in the rewrite input box will appear as a link. Click the link to test your rule. Its target will open in a new browser window or tab.

Example 2

You have created a custom page that you can access with the URL
http://www.something.com/c/4/0/information.html
and you want the URL
http://www.something.com/information 
to load the page.

Add a rule, give it a unique number and enter information in the rewrite input box, and then enter /c/4/0/information.html  in the URL input box.

Example 3

You have a URL for a gallery group page that looks like this
http://www.something.com/gallery/1132/1314/0/shoots-2015.html

and you want to use the following URL instead
http://www.something.com/latest-shoots

Add a rule, give it a unique number and enter latest-shoots in the rewrite input box, and then enter /gallery/1132/1314/0/shoots-2015.html in the URL input box and save your rule.

Example 4

You want to create a rewrite rule that loads specific search results. You can do this by first searching on your website. If the search results are what you want then copy the URL from your address bar. When you create a new rewrite rule you can paste the URL that you copied, but you must remove the website address part and spaces (or %20) must be replaced with a plus (+).
E.g. http://www.something.com/search?s=young%20woman should be changed to /search?s=young+woman

Example 5

You want a short url to display the latest video files. The relative path is /latest/media/f/footage but you want to use /footage instead.
Create a new rewrite rule and enter /footage in the rewrite input box, then enter /latest/media/f/footage in the target URL input box.
Note that you don’t have to use the word footage, it can be anything e.g. video, video+files, cine et cetera.
More information about this can be found in the article Infradox XS URL’s explained.

 

 

 

2017-11-25T14:28:42+01:00 February 7th, 2017|Categories: Configuration, Information|Tags: , , |