Iam developing a site in codeigniter.This is my url http://myserver.net/visio/UBwXo.
Here http://myserver.net/visio/ is my base_url.
After /visio/ here have a variable.When there have any value after /visio/ then i wantto take the corresponding url from database to this value.
That means in my database,
UBwXo => “*any url***“
jshom => “*any url***“
So when getting value after /visio/ i want to take the corresponding url from databse and redirect it in to that url without using htaccess.
I want to done this redirection process in index.php page of root folder.
Is this possible?
The orginal url for http://myserver.net/visio/UBwXo like myserver.net/visio/index.php/admin/index/UBwXo
the default controller is admin
First, create redirect.php file in the controllers folder (application/controllers) and add this code to this file:
Then create table in your database. Your table must be like this:
After that, set default controller value to the redirect class.
Open application/config/routes.php. Find
$route['default_controller'], then setredirectas a value to this variable, like this:Then enjoy life 😉
EDIT:
I had forgotten to mention URI routing in
config/routes.phpfor redirecting: