1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

mod_rewrite small issue

Discussion in 'Apache' started by Scorpiono, Jan 4, 2007.

  1. #1
    Hello there, i have view.php returning either ?n=Usersname or either ?pid=19283 pid stands for photo id.

    Is there a way, if the only parameter sent by the URL is pid, but it will also grab the name somehow?

    site/Username - this is when it returns ?n=Username

    but when it returns pid I wish something like

    site/photos/Username/PID

    ---

    Any ideas?
     
    Scorpiono, Jan 4, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    If only one shows up at a time, you can't have both in the URL at the same time unless you know how to edit the script and make them show up and you have to have a unique directory for each if only one is in the URL. If both do show up at the same time, use the last time.

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^photos/([^.]+)$ view.php?pid=$1 [L]
    RewriteRule ^username/([^.]+)$ view.php?n=$1 [L]

    RewriteRule ^photos/([^.]+)/([^.]+)$ view.php?n=$1&pid=$2 [L]
     
    Nintendo, Jan 4, 2007 IP
  3. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #3
    RewriteRule ^photos/([^.]+)/([^.]+)$ view.php?n=$1&pid=$2 [L]

    photos/param$1/param$2 - like this will show up ?

    photos/Scorpiono/99283/ ?
     
    Scorpiono, Jan 5, 2007 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    BINGO. But

    looks like only one shows up at a time. Then it won't work.
     
    Nintendo, Jan 5, 2007 IP
  5. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Thanks alot buddy, very appreciated
     
    Scorpiono, Jan 12, 2007 IP