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 problem

Discussion in 'Apache' started by timelf123, May 30, 2007.

  1. #1
    I cannot for the life of me figure out how to form this rule...

    I need to change this link:
    to
    thanks a ton in advance, I am a rewrite noob!

    This is what I have so far, but it does nothing (doesn't redirect anything)
    or

     
    timelf123, May 30, 2007 IP
  2. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Wrong section. Belongs to apache...:)
     
    inworx, May 31, 2007 IP
  3. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, I saw others like this in the main section so I thought it was fine
     
    timelf123, May 31, 2007 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    RewriteRule ^index\.php?r=(.*)$ http://www.main.mysite.com/index.php?r=$1 [R=301,L]
     
    Nintendo, Jun 1, 2007 IP
  5. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That code didn't work, so I changed it to

    RewriteRule ^?ref=(.*)$ http://www.cash.refstocash.com/?ref=$1 [R=301,L]

    because there is no index.php present in the links, it is just a ?ref=##

    My second rule now gives me an internal server error
     
    timelf123, Jun 1, 2007 IP
  6. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I solved it with this:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^(.*&)?r=[0-9]+(&.*)?$ [NC]
    RewriteRule ^$ http://www.main.domain.com/ [R=301,L]
     
    timelf123, Jun 2, 2007 IP