mod_rewrite question

Discussion in 'Apache' started by WillMarflow, Oct 16, 2008.

  1. #1
    WillMarflow, Oct 16, 2008 IP
  2. Krnl

    Krnl Peon

    Messages:
    60
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Krnl, Oct 16, 2008 IP
  3. WillMarflow

    WillMarflow Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Krnl!

    It works, but we need to have something before that, because if an affiliate username is "images" then that messes up the whole deal. As it then sends the users to the images folder.

    So I though I would make:
    http://www.domain.com/index.php?name=abc123
    direct to this URL:
    http://www.domain.com/aff/abc123

    However when changing:
    it didn´t work out.

    I really need to read a book on Apache :p

    thanks
     
    WillMarflow, Oct 16, 2008 IP
  4. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It just needs to be the other way around:

    RewriteRule ^aff/([^/\.]+)/?$ /index.php?name=$1 [L]
    Code (markup):
     
    Ladadadada, Oct 16, 2008 IP
  5. pondlife

    pondlife Peon

    Messages:
    898
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Just out of interest; why would you want to have the question mark (?) in your beautified URL?
     
    pondlife, Oct 20, 2008 IP
  6. WillMarflow

    WillMarflow Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    WillMarflow, Oct 28, 2008 IP
  7. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That's strange. It should work like that.

    You do still have the RewriteEngine On line in the .htaccess file ?

    If so, check that you also have AllowOverride All in your main httpd.conf. If you have something like AllowOverride None then .htaccess files won't work at all.

    After that, try adding [R] into the rewrite rule so that it ends with [R,L]. This will cause a redirect to happen which will change the URL. That way we will know that the rewrite engine is definitely on and we will also know what the URL is being changed into.
     
    Ladadadada, Oct 29, 2008 IP