Reputation: 2206
I am new to CodeIgniter bu I know CakePHP pretty well.
If I rewrite the following:
test -> welcome/login
test/(:any) -> welcome/login/$1
When I write my links i want to put a link to "welcome/login/asdas" in code and to be parsed as "test/asdas". CakePHP did that using the html link or router::url
EDIT:
What I mean is site_url('welcome/login/asd') should return "test/asd"
Upvotes: 0
Views: 3530
Reputation: 5476
I think that this is not possible. Actually, CodeIgniter just re-route your app from one URL to other using routes defined previously by yourself in route.php
This is the most far that you can go. site_url
is an internal CodeIgniter function that returns your site URL as you specify in config.php
file
site_url()
Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your site index_page in your config file) will be added to the URL, as will any URI segments you pass to the function.
You are encouraged to use this function any time you need to generate a local URL so that your pages become more portable in the event your URL changes.
Segments can be optionally passed to the function as a string or an array. Here is a string example:
echo site_url("news/local/123"); The above example would return something like: http://example.com/index.php/news/local/123
I'll try to study site_url
function located in url_helper.php
file (system/helpers/url_helper.php
| Line 42) and modify it to do whatever I want.
Upvotes: 1
Reputation: 4688
Try this
Go to application/config/routes.php
You can add the following variable in the routes.php
$route['test'] = "welcome/login";
$route['test/:any'] = "welcome/login/$1";
Browse this http://codeigniter.com/user_guide/general/routing.html
Upvotes: 0