1

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
5
  • Codeigniter have routing - ellislab.com/codeigniter/user-guide/general/routing.html check it. There you can set login to equals to auth/login Commented Apr 6, 2013 at 19:09
  • I know but the library has it's own links and redirects set with the "auth" in front and its a pain to try and change them all. i just want a rewrite rule so it can be done automatically. Commented Apr 6, 2013 at 19:15
  • If your script links point to auth/login then you must change them. And if you use @complex857 route it will work fine.. Commented Apr 6, 2013 at 19:18
  • @FlorianShena, tjat alone only would work the other way around, redirecting from /login to end up on /auth/login Commented Apr 6, 2013 at 19:19
  • @FlorianShena by the way this Tank_auth is last updated 2 years ago.. Be sure that its up to date for current CI version before using it. Commented Apr 6, 2013 at 19:24

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

@FlorianShena, sorry, i think i missed the point at first. This should be working now (seem to be ok in my test environment)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.