mod-rewrite troubles

Discussion in 'Apache' started by SimThePhpCoder, Dec 22, 2009.

  1. #1
    I am working on a project where almost every page needs to used mod-rewrite. after filling in the form http://rpg.antgaming.com and i hit submit i get this:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    
    Please contact the server administrator, webmaster@rpg.antgaming.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    
    More information about this error may be available in the server error log.
    
    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
    
    
    --------------------------------------------------------------------------------
    
    Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at rpg.antgaming.com Port 80
    Code (markup):



    my mod-rewrite code is this:
    RewriteEngine On
    
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule .*\.(jpe?g|gif|bmp|png|avi|zip|mp3|midi)$ /images/nohotlink.jpe [L]
    
    RewriteRule ^game/(.*)/crimes$ /crimes.php?game=$1 [NC,L]
    RewriteRule ^game/(.*)/estates$ /estates.php?game=$1 [NC,L]
    RewriteRule ^game/(.*)/invetory$ /inventory.php?game=$1 [NC,L]
    RewriteRule ^game/(.*)/shop$ /shop.php?game=$1 [NC,L]
    RewriteRule ^game/(.*)/train$ /train.php?game=$1 [NC,L]
    RewriteRule ^game/(.*)/userlist$ /userlist.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/crimegroupadd$ /admin/crimegroupadd.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/crimegroupmanage$ /admin/crimegroupmanage.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/crimeadd$ /admin/crimeadd.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/crimemanage$ /admin/crimemanage.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/estateadd$ /admin/estateadd.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/estatemanage$ /admin/estatemanage.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/newsadd$ /admin/newsadd.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/newsmanage$ /admin/newsmanage.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/itemadd$ /admin/itemadd.php?game=$1 [NC,L]
    RewriteRule ^game/admin/(.*)/itemmanage$ /admin/itemmanage.php?game=$1 [NC,L]
    
    ErrorDocument 404 /404.php
    php_value session.gc_maxlifetime 14400
    Code (markup):
    how can i stop this from happening?
     
    SimThePhpCoder, Dec 22, 2009 IP
  2. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What does the error log say, exactly? If not, enable the mod_rewrite log and see what you get.

    My first guess would be that "php_value session.gc_maxlifetime 14400" is what's causing the problem, probably not allowed in the htaccess.
     
    szalinski, Dec 22, 2009 IP
  3. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #3
    hehe. that worked for the most part

    I added a new line


    and get the following error

     
    SimThePhpCoder, Dec 25, 2009 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    Replace the first line

    RewriteEngine on

    with

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /

    And you can also try changing (.*) to ([^.]+)

    If this is just use at form submitting, mod_rewrite will hardly help you. mod_rewrite's for links, to make the URLs static for search engines.
     
    Nintendo, Jan 6, 2010 IP
  5. hostechsupport

    hostechsupport Well-Known Member

    Messages:
    413
    Likes Received:
    23
    Best Answers:
    7
    Trophy Points:
    138
    #5
    Hello,

    Please check in the server whether the rewrite module is installed in the server and compiled. If it is then the rewrite modules should work fine for you.

    Thank you.
    Regards,
    Hostech Support
     
    hostechsupport, Jan 13, 2010 IP