URL redirects, example with regular expressions
Hello,
I had some troubles creating URL redirects after studying the documentation under https://help.k15t.com/scroll-viewport/latest/configure-global-url-redirects-140546552.html.
Somehow my specifications with type "Glob Pattern" and wildcards * did not worked as I expected them.
So I focused on the regular expressions with the help of a co-worker who is a software developer. He very quickly created one specification to redirect quite a lot of our URLs.
I would like to share my example. The purpose is to redirect all URLs containing "latest/all/" to "latest/user-documentation". All URLs contain "de" (for German) or "en" (for English) after "all" or "user-documentation".
Here is the used redirect (please note that the URL are using placeholders and will not work):
Incoming URL: http://www.example.com/SPACE/latest/all/(de|en)/(.*)
Type: Regular expression
Target URL: http://www.example.com/SPACE/latest/user-documentation/$1/$2
So, http://www.example.com/SPACE/latest/all/de/Installation will be redirected to http://www.example.com/SPACE/latest/user-documentation/de/Installation. http://www.example.com/SPACE/latest/all/en/Tutorial/Example1 will be redirected to http://www.example.com/SPACE/latest/user-documentation/en/Tutorial/Example1
Maybe this example will helps others who are experiencing troubles creating the redirects.
Cheers,
Eva
-
Hi Eva,
thanks for your work on this.
I have created an internal document task, to improve this article with your example.
If you won't mind, I will also post this into our Google Group where other Viewport Developers are maybe searching for things like that.
Of course, you also could do this on your own. Feel free to sign up and post it, I and others would really appreciate it!Thanks again and have a nice day.
Best,
Steffen
Please sign in to leave a comment.
Comments
2 comments