avatar
replace text after last slash in url AEM

> Before:

this.accountPage = http://localhost:4502/content/flagtick/us/en/my-account.html;

> Process:

const index = this.accountPage.lastIndexOf('/') + 1;
const fileName = this.accountPage.substr(index);
console.log(this.accountPage.replace(fileName, 'errors/404.html'));

> After:

this.accountPage = http://localhost:4502/content/flagtick/us/en/errors/404.html;
24
get current page from sling model AEM get filename from URL dynamically change URL
You need to login to do this manipulation!