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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Arrow url configuration help

    I dont know if this is the right place for this topic but i have a problem.

    I want to use a thing like this when a user type in the address bar in the browser

    http://www.site.com/username
    like
    http://www.facebook.com/username

    In this way, i want to show user's profile on the basis of the username in the url.
    But here we are not getting any id with the username. So how can we retrieve this name from the url without any id.

    Any help please

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    This is performed by an apache module called mod_rewrite. It simply changes the provided url into one that provides the processing script the necessary querystring to process the request.
    With what you have above, you will have a difficult time controlling it. If you were to match anything tha tis ^/X, then it will always assume it matches a username. A better target may be to use /user/X, so you can identify that as being a username in particular.
    See this link for more information on mod_rewrite: http://httpd.apache.org/docs/current...d_rewrite.html

  • Users who have thanked Fou-Lu for this post:

    Arjun21 (11-10-2011)

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    i got it

    Here i edited the .htaccess file such that when any file or directory does not exist then it points to the page in which i want to show the users profile

    ErrorDocument 404 /index.php
    getting the userid through this php code
    PHP Code:
    <?php
    $getusername 
    $_SERVER['REQUEST_URI'];
    $getusername str_replace("/","",$getusername);
    echo 
    $getusername;
    ?>
    Thanks for help


  •  

    Posting Permissions

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