The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.httaccess - 500 Internal Server Error

Discussion in 'General Discussion' started by Ivo Danic, Jan 15, 2016.

  1. Ivo Danic

    Ivo Danic Active Member

    Joined:
    Dec 1, 2015
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    México
    cPanel Access Level:
    Root Administrator
    Hi
    An user move his site to my VPS and shows Internal server error, but when i remove the httaccess, the site looks good, but the rewriter doesnt work. here is the httacces file content.

    Code:
    php_value  max_input_vars 5000
    php_value  session.gc_maxlifetime 10800
    php_value  register_globals Off
    
    
    ErrorDocument 404 /404
    RewriteEngine  on
    
    ## EXPIRES CACHING ##
    #<IfModule mod_expires.c>
    #ExpiresActive On
    #ExpiresByType image/jpg "access plus 1 month"
    #ExpiresByType image/jpeg "access plus 1 month"
    #ExpiresByType image/gif "access plus 1 month"
    #ExpiresByType image/png "access plus 1 month"
    #ExpiresByType text/css "access plus 1 month"
    #ExpiresByType text/javascript "access plus 1 month"
    #ExpiresByType application/pdf "access plus 1 month"
    #ExpiresByType text/x-javascript "access plus 1 month"
    #ExpiresByType application/x-shockwave-flash "access plus 1 month"
    #ExpiresByType image/x-icon "access plus 1 year"
    #ExpiresDefault "access plus 7 days"
    #</IfModule>
    ## EXPIRES CACHING ##
    
    # stuff to let through (ignore)
      RewriteCond %{REQUEST_URI} "/admin/" [OR]
      RewriteCond %{REQUEST_URI} "/new_admin/" [OR]
      RewriteCond %{REQUEST_URI} "/includes/" [OR]
      RewriteCond %{REQUEST_URI} "/tunnel.php"
      RewriteRule (.*) $1 [L]
    
    # REDIRECT TO ADMIN/LOGIN
    RewriteCond %{REQUEST_URI} ^/administration$
    RewriteRule ^(.*)$ https://www.example.com.mx/admin/login? [r=301,L]
    
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    RewriteCond %{SERVER_PORT} !^443
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    RewriteCond %{REQUEST_URI} ^/our-program$
    RewriteRule ^(.*)$ /our-program/about? [r=301,L]
    
    RewriteCond %{REQUEST_URI} ^/franchises$
    RewriteRule ^(.*)$ /franchises/become-a-franchisee? [r=301,L]
    
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    RewriteCond %{SERVER_PORT} !^443
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    ##### ATTEMPT TO SEE IF I CAN MAP page=XX TO THE CORRENT FRIENDLY URL
    RewriteRule ^([^.]+)?$ index.php?arg1=$1 [QSA]
    
    RewriteRule \.(?:doc|docx|xls|xlsx|pdf|txt|cad|zip|rar)$ filehandler.php [QSA,L,NC]
    RewriteRule \.(?:jpeg|jpg|png|ico)$ convertProgressive.php
    
    RewriteRule ^sitemap.xml$ sitemap.php [nc]
    
    #Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*) index.php [PT,F,L]
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    
    Hope you can help me
     
    #1 Ivo Danic, Jan 15, 2016
    Last edited by a moderator: Jan 15, 2016
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. Ivo Danic

    Ivo Danic Active Member

    Joined:
    Dec 1, 2015
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    México
    cPanel Access Level:
    Root Administrator
    I removed the three first lines and everything is fine! Why? the site works at 100%
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    It's likely you are using the suPHP handler for PHP which does not support the use of the "php_value" flag in the .htaccess file. You should instead copy /usr/local/lib/php.ini to the account's home directory and adjust your custom php values accordingly.

    Thank you.
     
  5. Ivo Danic

    Ivo Danic Active Member

    Joined:
    Dec 1, 2015
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    México
    cPanel Access Level:
    Root Administrator
    Could you please tell me the comands to do this? Or how do it? Thanks for all!
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, here are the commands:

    Code:
    cp -a /usr/local/lib/php.ini /home/$username/public_html/
    chown $username.$username /home/$username/public_html/php.ini
    vi /home/$username/public_html/php.ini
    Replace "$username" with the username of the account. The last command invokes "vi" and allows you to modify the php.ini file for the individual account:

    How to Use the vi Editor

    Thank you.
     
  7. Ivo Danic

    Ivo Danic Active Member

    Joined:
    Dec 1, 2015
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    México
    cPanel Access Level:
    Root Administrator
    i did it! But i cant acces into an admin panel, the admin panel path is http://www.domain.com/admin/login
    in the httaccess shows the login path, this problem is cause i modify the php.ini?
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you provide more details about what happens when you attempt to access your admin page? The php.ini file should not prevent it from loading.

    Thank you.
     
  9. Ivo Danic

    Ivo Danic Active Member

    Joined:
    Dec 1, 2015
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    México
    cPanel Access Level:
    Root Administrator
    What happens .... when i try to acces only changes de url, just adds the s500.html
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Is there any new output to /usr/local/apache/logs/error_log when this happens?

    Thank you.
     
Loading...

Share This Page