URL Rewriting from a Plugin based on custom values

I have done it like this. From the plugin admin menu, I have created option where user can select the page where they want to install the plugin. Based on the value selected, the URL rewriting was done and the selected page id is stored as an option field. I created two custom variable for this. The plugin serve template file for that page based on the value of the custom variables.