SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    0 Post(s)
    0 Thread(s)

    Probably not the first with 500 internal server error

    Hello, quick introduction so you understand what I'm dealing with:
    I'm a second year college student in Belgium, mostly interested in webdesign. I have to create a php project (I do love php) and I had had the choice between using the school's server (ftp) or my own server (ssh). So I chose mine. For this project, I would need an apache server, configured it, it works for what I want to do: local testing.

    Now my problem (after an hour of google, I decided to take my chance and make a post here):
    I have to use .htaccess for my project to rewrite the urls. Pretty basic stuff for you server guys probably. Now we got a script from school for the .htaccess file:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    first problem I had was that the apache server didn't recognize this file because I didn't allow rewriting it. So I googled a bit, and changed my config:
    location: /etc/apache2/sites-available/web
    <VirtualHost *:8080>
    ServerAdmin Brent
    ServerName **************
    DocumentRoot /var/www/web
            <Directory /var/www/web>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            ErrorLog /var/www/web/error.log
            CustomLog ${APACHE_LOG_DIR}/accessregistrationpage.log combined
    the changes I made: I set AllowOverride All, in stead of AllowOverride None
    I also noticed that in the default file, this directery was also listed there, also having the AllowOverride option. Now I changed this too in the first place, but after testing if it worked without it, I changed it back to AllowOverride None (while restarting the apache server between the changes)

    This "worked": in stead of getting an error "this URL does not exist" I got another one and now I'm pretty stuck:
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, Brent 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.
    Apache/2.2.20 (Ubuntu) Server at ******* Port 8080
    I tested a few more things:
    - clearing the .htaccess file I created in a sub directory of my web dir, fixes the problem, makes me think the issue is in my htaccess file (you see I study IT, right? ), I do need the htaccess though :P
    - chmod -R 755 . in my web dir, didn't change anything
    - I created a default .htaccess file in the web dir with no contents, didn't change anything

    So my guess, just out of the blue because I just read and copy/paste concering server configuration here, is that my apache server is out of date, and the .htaccess script we got from school uses some new stuff. However I have no idea if this is correct, I would test it but I have no clue how to update this server, because a friend installed it, like I mentioned, I'm not a server guy

    Maybe some more relevant information:
    - my server uses Ubuntu Server 11.10
    - it's Apache 2.2.20 (I think that because the 500 error sais that)
    - I run my server on port 8080 because my provider doesn't allow me to forward 80
    - everything worked, except the htaccess, if I turn it off, or clear the file, it just works.

    Thanks for your time, hope to receive an answer, but I'll will be searching for one myself around the web too ofcourse.
    Brent (I had to use my IGN because someone already used my normal name here )

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    40 Post(s)
    1 Thread(s)
    Check what /var/www/web/error.log says, and try your htaccess putting one section at a time

  3. #3
    SitePoint Member
    Join Date
    Nov 2012
    0 Post(s)
    0 Thread(s)
    Quote Originally Posted by EastCoast View Post
    Check what /var/www/web/error.log says, and try your htaccess putting one section at a time
    Solved it yesterday: had to enable modrewrite:
    sudo a2enmod rewrite

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    19 Post(s)
    3 Thread(s)

    The primary cause for 500 errors is a syntax error (misunderstood directive) in the .htaccess file.

    While I dislike your mod_rewrite code, it doesn't look like it should be the cause of the 500 error.


    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts