Forum / Development Forum / Support request / Clean URL's and Query String Behavior 


+   Reply to Thread

I'm having an issue and I'm not sure how to solve it. I have the following URL example:

http://mysite.com/project/home/2

Where project is the base URL for the site, home is a controller and 2 is a query string parameter that the front controller is capturing. When I use this I get the following URL's generated by Rain.TPL:

http://mysite.com/project/home/home

This URL is not what I'm after. It breaks all style and image includes and all links. I don't want to turn off the URL parser because it's a useful feature, but I need it to ignore parts of the URL that are query strings. I can add them as actual query string parameters (after the ?), but that makes for messy URL's. Do you have any suggestions how I can keep my front controller unchanged and get this to work correctly?
Sure, you can remove from path_replace_list the "a" voice:

http://www.raintpl.com/Documentation/Documentation-for-PHP-developers/Methods/Configure/#path_replace_list

Than you can add {#URL#} to your url as follows <a href="{#URL#}/home/2">

or either add to your html header: <base href="your site url" />
so now all link and images will have as base url the site url you selected into this tag
Thanks for the quick response. I have used Rain.TPL on 2 recent projects, the most recent being http://jjlegendre.com/formed/ which is a project site for Formed, my easy HTML form generator class. Thanks again for your response and for sharing your great solution!   JJ Legendre

+   Reply to Thread