We have a requirement to override page publish url/path (with some customized url) while publishing the page and commit this new custom path to broker DB, irrespective of the 'directory' value set in the structure group. (i.e.) ignoring the structure group directory value.

To be more specific below is our exact requirement:

If we publish any page from parent structure group or its child structure group(s) of any level ,we want to set the page publish url (path) for all the pages as '\PageFileName.extension' (ex:\Article.html)

Where Root(parent structure group) has its directory value set to blank path ().So we want to ignore the child Structure Group(s) directory field value in the page url when we publish any pages with in them.

Is this functionality any way possible while publishing? Either using .Net Templating (or) Event Handlers(or) Deployer Extension(or)Custom Resolver can we achieve this? If possible please suggest any help is highly appreciated.

I think we can change Page file Name or set binaries publish location using code while publishing and even we can read publish location of page in Templating code but is it possible to change the directory/publish url of the page itself from code while publishing?

**Attaching the screenshot with our requirement briefed out**
![Modify Page URL while publishing](https://i.stack.imgur.com/JDR8v.png)