Hello Reader's in this blog we will see most usefull things which you can make from your website URL, by using codeingter.
Lets talk about the SEO freindly URL. In some site you have seen the URL's are very clean and short. This is important as in perspective view of SEO ranking in google. The more precise the URL will make more chances to become website popular.
So Codeigniter comes up with a feature name as 'URL Routing'. The concept of this is to make a alias URL in place of real URL. Both the URL will work same. To make this you have to do steps as below:-
first open routes.php in config folder.
Create a new route. For example
$route['newurl'] = 'abc.com/project/create-project/upload.php';
Here you can see the actual URL "abc.com/project/create-project/upload.php" is alias by "newurl" which is short. Now you just have to access this page by hitting "abc.com/newurl".
Secondly, passing the prams with URL.
If you are passing many param through then Codeingter offers to use $this->uri->assoc_to_uri()
$array = array('file' => 'abc', 'route' => 'location', 'type' => 'text');
$intputtourl = $this->uri->assoc_to_uri($array);
Like above I create array with all the params inside it. So Codeigniter function 'assoc_to_uri()' will auto convert this into plain string. Which will look like this:
file/abc/route/location/type/text
Now you can put $intputtourl in url which will easy to integrate.
0 Comment(s)