HELP with RewriteRule

Discussion in 'PHP' started by ozab, Jun 26, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Hi, My page is not loading, buy.php

    What is wrong with this code? Thanks!

     
    ozab, Jun 26, 2007 IP
  2. javaguru

    javaguru Banned

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What?????????????????

    What you trying to do?
     
    javaguru, Jun 26, 2007 IP
  3. mrmonster

    mrmonster Active Member

    Messages:
    374
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Post a little more info, like what URL you are testing, what path your .htaccess is under and path to buy.php
     
    mrmonster, Jun 26, 2007 IP
  4. ozab

    ozab Well-Known Member

    Messages:
    444
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #4
    www.3b4.org

    .htaccess is on root of the site so is buy.php
     
    ozab, Jun 26, 2007 IP
  5. mrmonster

    mrmonster Active Member

    Messages:
    374
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #5

    You still haven't said what URL you are testing with that fails. What are you trying to rewrite?
     
    mrmonster, Jun 27, 2007 IP
  6. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #6
    I'm assuming buy.php?word=wordhere to buy/wordhere
     
    crazyryan, Jun 27, 2007 IP
  7. mrmonster

    mrmonster Active Member

    Messages:
    374
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #7

    domain.com/buy/hello would work with his current rewrite, but since he says it's not working he must be trying something else or his server doesn't allow rewriting.
     
    mrmonster, Jun 27, 2007 IP
  8. ozab

    ozab Well-Known Member

    Messages:
    444
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Thanks for the reply guys.

    When I goto my homepage And in the box type any word then when I press SUBMIT.

    The page does not come up.
     
    ozab, Jun 27, 2007 IP
  9. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #9
    mrmonster is right, your current rewrite is missing the FollowSymLinks option.

    So here is the working one:
    
    Options FollowSymLinks
    RewriteEngine On
    RewriteRule ^buy/(.*)$ buy.php?word=$1 [L]
    
    Code (markup):
     
    VimF, Jun 27, 2007 IP
  10. ozab

    ozab Well-Known Member

    Messages:
    444
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #10
    ok, I copied the above code in .htaccess file and uploaded and still not working. :confused:
     
    ozab, Jun 27, 2007 IP
  11. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #11
    are you adding a / after the last word? buy/something/ ?

    
    RewriteEngine On
    RewriteRule ^buy/(.[^/]+?)/?$ buy.php?word=$1 [L]
    
    Code (markup):
     
    ansi, Jun 27, 2007 IP
  12. mrmonster

    mrmonster Active Member

    Messages:
    374
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #12
    Check if your server has rewrite enabled, do a phpinfo() and search for mod_rewrite

    It's starting to sound like it's not enabled or you are trying something other than what you are typing out here.
     
    mrmonster, Jun 27, 2007 IP
  13. ozab

    ozab Well-Known Member

    Messages:
    444
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #13
    Still no luck,, :(
     
    ozab, Jun 27, 2007 IP
  14. mrmonster

    mrmonster Active Member

    Messages:
    374
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #14
    Verify that mod_rewrite is enabled by looking at the output of phpinfo()
     
    mrmonster, Jun 27, 2007 IP
  15. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #15
    save this in a file called modcheck.php

    
    <?php
        $a = apache_get_modules();
        echo (in_array("mod_rewrite",$a)) ? "enabled" : "disabled";
    ?>
    
    PHP:
    let us know the output.
     
    ansi, Jun 27, 2007 IP
Thread Status:
Not open for further replies.