views:

104

answers:

1

Hello,

Below you will find my current vHost entry that I am using for a site that I currently have under development. This vHost entry works fine when I have it on my local machine, but when I push my code to my staging server that is running this same vHost record I receive a 500 Internal Server error.

The machine I'm running this vHost on is running Apache 2.2.9 (Debian).

<VirtualHost 206.217.196.61:80>
    SuExecUserGroup 13labs 13labs
    ServerAdmin [email protected]
    ServerName admin.13labs.net
    ServerAlias admin.13labs.net

    DirectoryIndex index.php
    DocumentRoot /var/www/13labs.net/html/admin/
    ErrorLog /var/www/13labs.net/logs/error.log

    # Hide .svn Directories
    <DirectoryMatch "\.svn">
            Order deny,allow
            deny from all
    </DirectoryMatch>

    # FastCGI
    Alias /fcgi-bin/ /var/www/13labs.net/fcgi-bin/

    AddHandler php-fastcgi .php
    AddType application/x-httpd-php .php
    Action php-fastcgi /fcgi-bin/admin-php.fcgi

    <Directory /var/www/13labs.net/fcgi-bin/>
            SetHandler fcgid-script
            AllowOverride None
            Options -Indexes +ExecCGI -FollowSymlinks -SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    <Directory /var/www/13labs.net/html/admin/>
            AllowOverride None
            Options -Indexes -FollowSymlinks -SymLinksIfOwnerMatch
            FileETag All
    </Directory>

    # Rewrite Logic
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^/(.+)$ /index.php/$1 [PT,QSA,L]

Thanks for any help that you can provide.

Best regards,
Andrew

A: 

After many trial and errors I have found that the working RewriteRule needs to be the following:

RewriteRule ^.*$ /index.php$1 [PT,QSA,L]

Then in PHP I need to be using $_SERVER['REQUEST_URI'] instead of $_SERVER['PATH_INFO'] to make sure my PHP script see the passed in URI.

Andrew Ellis