Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts

    URL Rewrite Question

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

    Hi this works ok for:

    http://domain/user

    but not for:

    http://domain/user/

    What should I add to make the trailing slash at the end take?

    Thanks.


    EDIT:

    Answer:

    RewriteEngine on
    RewriteRule ^([^/\.]+)/?$ user.php?username=$1
    Last edited by theflyingminstr; 10-26-2010 at 01:19 AM.

  • #2
    Regular Coder
    Join Date
    Jul 2007
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I posted the EDIT as the answer:

    EDIT:

    Answer:

    RewriteEngine on
    RewriteRule ^([^/\.]+)/?$ user.php?username=$1


    .. but now if I try to go to any folder (ex: http://domain/folder/) it takes me to the mod rewrite setting trying to find a user with that folder name:

    RewriteEngine on
    RewriteRule ^user/([^/\.]+)/?$ user.php?username=$1 [NC]
    Last edited by theflyingminstr; 10-26-2010 at 02:18 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •