Hunain
Hunain

Reputation: 95

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

e.g: as stated above, in form the code is

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

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

Upvotes: 0

Views: 975

Answers (2)

stormdrain
stormdrain

Reputation: 7895

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.

Upvotes: 1

egig
egig

Reputation: 4430

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.

Upvotes: 0

Related Questions