Florian Shena
Florian Shena

Reputation: 1434

Remove url segment

I am using the codeigniter Tank_auth library and I want to remove the "auth' part from all the urls.

http://mysite.dev/auth/login

to

http://mysite.dev/login

Upvotes: 1

Views: 247

Answers (1)

complex857
complex857

Reputation: 20753

Use the routes configuration, add something similar to this to application/config/routes.php:

$route['login'] = 'auth/login';

Once you got this set up, you can make the webserver to redirect users from the old url like this:

RewriteRule ^auth/login http://%{SERVER_NAME}/login [L,R=302]

This one will redirect old url requests to the newly handled /login, you might want to handle https:// or subdirectories in later part of the rule.

The whole setup seems a little hackish, changing the generated urls seem to be a better idea.

Upvotes: 1

Related Questions