URL Title with Slash Redirect

By tsangktsangk

Description

Allows _template or ListPages variables like title which can hold slashes (e.g. Show/Hide content from specific users) to be used in NewPage url:
e.g. http://wikidot.com/test/edit/true/title/Re:Show/Hide content from specific users will change
to
http://wikidot.com/test/edit/true/title/Re:Show%2FHide content from specific users will change

Changelog:

  • 4th Jan 2017
    • Fixes unescaped percentage sign issue reported by rurwin below
    • Adopts the URL protocol supplied in the hash (rather than defaulting to http).
    • Adds a click-through link in case the Javascript-based redirect fails.
    • Fixes (round 2): script tag duplicated

Code

[[image test.jpg link="http://snippets.wdfiles.com/local--code/code:url-title-with-slash-redirect/1#http://cyclods.wikidot.com/post:new-post-84/edit/true/parentPage/thread:84/tags/_open/title/Re: Show/Hide content from specific users"]]

If you want to make sure there's no session leakage in HTTPS, make sure you supply both URLs in HTTPS:

[[image test.jpg link="https://snippets.wdfiles.com/local--code/code:url-title-with-slash-redirect/1#https://cyclods.wikidot.com/post:new-post-84/edit/true/parentPage/thread:84/tags/_open/title/Re: Show/Hide content from specific users"]]

Code tested for Firefox and IE.


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by tsangk

404 (Page does not exist) Redirect - 20 Nov 2012 11:40
Custom HTML Blocks - 25 Oct 2012 11:30
Syntax Highlighter - 16 Feb 2012 01:45
Conditional Blocks - 15 Feb 2012 00:36


Rate this solution

If you think this solution is useful — rate it up!

rating: +1+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License