[Solved] Remove the string from URL


Here is one way to do it.

<cfset normalURL = "http://test.com/myhome/live">
<cfoutput><p>#normalURL#</p></cfoutput>

Output from above code:

http://test.com/myhome/live

<cfset stringAfterLastSlash = ListLast(normalURL,"https://stackoverflow.com/")>
<cfoutput><p>#stringAfterLastSlash#</p></cfoutput>

Output from above code:

live

<cfset stringRemovedFromURL = Replace(normalURL,"/#stringAfterLastSlash#","")>
<cfoutput><p>#stringRemovedFromURL#</p></cfoutput>

Output from above code:

http://test.com/myhome

You can play with this code and see the results here.

solved Remove the string from URL