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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts

    Dynamic short / search engine friendly URL's

    Hello,

    I'd like to use short URL's in my site. I've seen a lot of these online, programs that sort of amalgamate the parts of the long URL e.g. www.mysite.com/interests.php?user_id=12&access=2

    What I'd really like, is if I could specify what the short URL should be e.g. myinterests, and that when someone typed in www.mysite.com/myinterests/ it would display the longer URL page (but not redirect them just display it). Is there a way where I can store the short url I'd like to relate to the 'long url' in a database, and when a page in the site is accessed it works out which page to actually display?

    I don't know how to go about doing this, but I think it would be really helpful for Yahoo search results, and it looks MUCH nicer for users.

    Any ideas? Any tutorials are good too. I've looked through quite a few, but none of them are dynamic i.e. they use htaccess files (which I'm guessing you can't update dynamically using php) to redirect the user to the right page. I'd like something that's completely dynamic.

    Thanks,

    Nicky

  • #2
    Regular Coder
    Join Date
    Jun 2008
    Location
    SE Wisconsin, US
    Posts
    222
    Thanks
    1
    Thanked 20 Times in 20 Posts
    I am not much of a PHP coder, but, from what I understand, one way to handle this is through modifying your .htaccess file. In ASP.Net (my expertise), you can create a custom HTTP handler to parse and rewrite the URL as needed or use the IIS 7.0 URL Rewrite module. Perhaps there are options like these in the PHP and Linux world?

    Hope that helps!
    Milwaukee Web Designer and SEO Milwaukee Firm specializing in ASP.Net, C#, VB.Net, SQL Server and Access.

  • #3
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts
    Here is a good tutorial for you!!

    http://www.addedbytes.com/apache/url...for-beginners/

  • #4
    Regular Coder
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    118
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Put this in .htaccess
    Code:
    RewriteRule ^interests/([0-9]*).*$ interests.php?user_id=$1
    Use this link:
    Code:
    <a href="interests/$RandomUserID">$RandomUsername</a>


  •  

    Posting Permissions

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