简体   繁体   中英

Change URL of page in Codeigniter

Here is the deal: I have a login form where the user logs in. If validation passes, they are redirected to

example.com/members/landing

How can I change this into only example.com/landing . Is there any way to change the url shown to the user on browser, while in the back, the form_open has different methods to call

eg: as stated above, in form the code is

<?php echo form_open(members/landing); ?>

but the browser must display landing or anything....

In config/routes.php:

$route['landing'] = '/members/landing';

What this does is send any request to example.com/landing to the example.com/members/landing controller. So then your form:

<?php echo form_open('/landing'); ?>

should work as expected.

You are using codeigniter, edit your routes.php and change the default Controller; or if you only need to display custom URL, you can use .htaccess file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM