2010-04-13 62 views
0

下面你會發現,我使用,我目前正在開發一個網站我目前的虛擬主機條目。這個vHost條目在我的本地機器上工作正常,但是當我將代碼推送到運行此相同vHost記錄的暫存服務器時,我收到500內部服務器錯誤。虛擬主機重寫規則正在建立一個500錯誤

該機我正在上運行的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] 

感謝您的幫助,您可以提供。

最好的問候,
安德魯

+0

看來有進一步的調查,如果我物理定義了一個RewriteRule,它會起作用,但是通配規則失敗。例如,該作品 「重寫規則^ /用戶/登錄$ /index.php/user/login [PT,QSA,L]」,但是這不工作「的RewriteRule ^(。*)$ /index.php$1 [PT, QSA,L]」 – 2010-04-13 05:58:45

回答

0

很多試錯後,我發現,工作重寫規則必須是以下幾點:

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

然後我需要使用$ _ SERVER [ 'REQUEST_URI']而不是$ _SERVER ['PATH_INFO']來確保我的PHP腳本能夠看到傳入的URI。