Is it possible to create such urls in codeigniter?
http://site.com/shorturl/
Where shorturl isn’t a physical controller file, but a variable.
I expect the algorythm for parsing url query to be like this:
1) Search for physical controller file. If exists, do standard codeigniter routine. If not
2) Try to load special controller file, where “shorturl” is a variable. Do further stuff inside that controller.
Thanks in advance
The previous answer seems quite good, but thought I’d share what I’d though of.
If you set your
404_overrideto point to a controller you have set up as follows:Any URL that doesn’t exist (any short URL for example) would get sent there, where you could do the following to check the value:
That would give you the value you need to check. If all is well, do the redirect, if the code doesn’t exist, you can then use the
show_404method to actually show the 404 page.