Accessing dynamic links in the format of domain.com/<dynamic_page_name> |
I am using code Igniter for my PHP project. I want to give provision in my site such that users can create new pages of their own, and access them directly from www.domain.com/<their_page_name>.
But, my developers have raised a concern that, 1000's of dynamic links that are presented in the format of domain.com/<page_name> is "not good for site's performance". For some 10-15 pages, it is fine. But, beyond that, it would effect the site's performance. So, they proposed that the URL format should be like www.domain.com/something/page_name (here, 'something' is the controller name) But, I really can't sacrifice my framework nor my requirement. Is there any way that I can achieve the format of "www.domain.com/<page_name>" without effecting the site's performance? Thanks a lot for the help
What could possibly work is, to have a special subdomain for yhose user created pages, so your URLs would be user.domain.com/page_name and then use mod_rewrite to rewrite user.domain.com/page_name to www.domain.com/userpagecontroller/page_name
Then you don't need checks if that page_name is in fact a user created page, or some other page.
Website: http://tomaz.lovrec.eu
GitHub: https://github.com/slax0rr Twitter: https://twitter.com/slax0rr
Thnks a lot for the reply.
But, is it possible to altogether hide the controller name in the URL and access it directly from domain.com/page_name ?
Well, you could make routes for every page name as well.
PHP Code: $route["page_name1"] = "controller/page_name1"; But, then each time you add/delete/update a page controller or method, you will have to update the routes. But would still be a better solution than my previous suggestion. I was probably drunk then. Edit: of course if you have a lot of those pages stored in the database, and you want to have it dynamic, you can easily extend the router and make dynamic routes for those pages this way.
Website: http://tomaz.lovrec.eu
GitHub: https://github.com/slax0rr Twitter: https://twitter.com/slax0rr |
Welcome Guest, Not a member yet? Register Sign In |