简体   繁体   中英

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

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.

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