Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Member ThePhoenix2006's Avatar
    Join Date
    Mar 2005
    Location
    Michigan
    Posts
    88
    Member #
    9431
    Hey there,

    Can anyone help me or point me in the right direction for masking a link? For example:

    www.domainname.com/?id=1

    www.domainname.com/bandname

    How would I get "bandname" to take you to "?id=1"

    I hope I can break this down so someone can help.

    Thanks a bunch in advance!
    "Make sure the juice is worth the squeeze" ~The Girl Next Door

  2.  

  3. #2
    Senior Member straight_up's Avatar
    Join Date
    Dec 2003
    Location
    Pennsylvania/Arizona
    Posts
    601
    Member #
    4309
    I'm not 100% sure what you want... I have an idea, though.

    Clarification & turtle dollars would help
    I am Alan Hogan (@alanhogan on Twitter). I like PHP, UI/UX design, and OS X.

  4. #3
    Senior Member straight_up's Avatar
    Join Date
    Dec 2003
    Location
    Pennsylvania/Arizona
    Posts
    601
    Member #
    4309
    For example, do you already have some sort of Content-Management System, or just thinking about this stuff before you get started?
    I am Alan Hogan (@alanhogan on Twitter). I like PHP, UI/UX design, and OS X.

  5. #4
    Senior Member Stylise's Avatar
    Join Date
    Jul 2005
    Location
    Mount Martha, Australia
    Posts
    229
    Member #
    10679
    Google for 'Search Engine Friendly URL mod_rewrite'.

  6. #5
    Senior Member straight_up's Avatar
    Join Date
    Dec 2003
    Location
    Pennsylvania/Arizona
    Posts
    601
    Member #
    4309
    IMO, better than mod_rewrite redirecting the browser is a mod_rewrite *hidden* or *server-side* redirect.

    Plus, I don't think the article Stylise mentions does exactly what you what (but I'm not quite sure what you want).

    What *I* do is this:

    All the links/urls are like:
    www.ghscc.com/about/
    www.ghscc.com/articles/firefox/1/
    www.ghscc.com/newsletter/alerts/

    But I'm using mod_rewrite to redirect any URL that does not have a period in it to page.php. BUT the user doesn't get redirected, i just tell APACHE that I really want page.php.

    THEN, in page.php, we $_ENV[REQUEST_URI] (learn the $_ENV superglobal!), grab that string (/newsletter/alerts/), for example, and then, in our MySQL database, grab the page_id associated with that URL.

    There are a few more details, but that's how we do it.

    The benefit is the user & the search engine ALWAYS see /newsletter/alerts/, and the PHP can grab an ID, and if sometime in the future I lose my mind, drop PHP, and do ASP or something, the URL won't break because it used an old ID or because it referenced a PHP file that doesn't exist anymore.

    Whew!

    If you want the code I'm using in my rewrite file, ask for it... and the php code I can also share w/ you... but turtle dollars would help
    I am Alan Hogan (@alanhogan on Twitter). I like PHP, UI/UX design, and OS X.

  7. #6
    Senior Member Fallout's Avatar
    Join Date
    Aug 2003
    Location
    Richmond, Virginia
    Posts
    543
    Member #
    2748
    Stylise meant the same thing. Apache's mod_rewrite is what you are looking for.

  8. #7
    Senior Member straight_up's Avatar
    Join Date
    Dec 2003
    Location
    Pennsylvania/Arizona
    Posts
    601
    Member #
    4309
    Code:
    RewriteRule   ^([^\.]*)$  /php/page.php
    What I do!
    PHP Code:
    <?php
    $curPage 
    strtok($_ENV[REQUEST_URI],'?'); //remove GET variables
    if ( strpos($curPage,'.')===false and (substr($curPage, -1) != "/") )
    {
      
    $curPage .= "/"//add final slash (internally) if not present
    }
    ... 
    database lookup ...
    ?>
    I am Alan Hogan (@alanhogan on Twitter). I like PHP, UI/UX design, and OS X.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:01 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com