Remove /auth/ from url?

#1
[eluser]oo00_Mr_K_00oo[/eluser]
Hey there

I'm using the lovely DX_Auth in my app to look after login etc

It's working really well ... and it's a great bit of code.

I want to tailor my app though ... DX_Auth uses two url slugs to drive sections of it.

index.php/auth/login/ or index.php/auth/register/

and for backend stufff (by default) it's
index.php/backend/users/

Of course I've changed the /backend/ bit to something less well known for my admin stuff ...

But I want to dump the /auth/ altogether for the users

Of course I have .htaccess for ripping out the index.php - but my .htaccess skills are ... well... crap

I basically want to have
www.mydomain.com/login/ ... point to www.mydomain.com/index.php/auth/login/

I want to then be able to do
www.mydomain.com/username ... and use the username variable out of the url .. just like twitter's www.twitter.com/oo00_Mr_K_00oo etc

Thoughts?

I did try this:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    
    #specific rules now
    
    RewriteRule ^/login/(.*)$ index.php/auth/login/$1 [L]
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
</IfModule>

#2
[eluser]Dam1an[/eluser]
URI Routing to the rescue

#3
[eluser]oo00_Mr_K_00oo[/eluser]
Yeah I've been looking at that .. I realised you posted that answer on a similar question - I was going to pull mine but ....I'm really struggling to get routing sorted out ...

Do you simply say

$route['url/expected'] = anything/I/want/here; - well within reason?

So I could do ...

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

I must be doing something else wrong if that's the case .. hmmm

#4
[eluser]Dam1an[/eluser]
I normally don't have forward slashes at the start/end, that might be causing you some problems

#5
[eluser]oo00_Mr_K_00oo[/eluser]
YES!! ... got it sorted Smile

and I do love the power of these routes ... oh man I'm having fun with them now - THANK YOU!!

yea - it was the / that was causing the issue

#6
[eluser]Dam1an[/eluser]
I'd assume it cause if you start a route with a forwrd slash, it looks for an absolute path, whereas you want yours to all be relative Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.