2012-11-23 43 views
0

我正在.htaccess文件來運行一個框架,我的測試,但是當我試圖進入我的本地主機,其中位於該框架的文件的文件夾沒有露面。 如果我嘗試訪問,請求localhost/my_hidden_folder/這會引發500錯誤,內部服務器錯誤。的.htaccess它躲在我的文件夾在本地主機

此行爲與我的Apache的一些錯誤配置的結果| htaccess的,我敢肯定,因爲在另一臺服務器相同的.htaccess工作正常。

這裏是我的.htaccess:

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-l 

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] 

這裏是/etc/apache2/sites-available我的默認文件:

<VirtualHost *:80> 
    ServerAdmin [email protected] 

    DocumentRoot /var/www 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride All 
      Order allow,deny 
      allow from all 
    </Directory> 
    <Directory /var/www/entrega2> 
      AllowOverride All 
    </Directory> 
    <Directory /var/www/unlp> 
      AllowOverride All 
    </Directory> 

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
    <Directory "/usr/lib/cgi-bin"> 
      AllowOverride None 
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
      Order allow,deny 
      Allow from all 
    </Directory> 

    ErrorLog ${APACHE_LOG_DIR}/error.log 

    # Possible values include: debug, info, notice, warn, error, crit, 
    # alert, emerg. 
    LogLevel warn 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

兩個文件夾,/var/www/unlp/var/www/entrega2具有相同的.htaccess文件,都被隱藏。

在.htacces文件最基本的重定向不工作,在我的本地主機,但在服務器的工作原理。也許我有一個模塊被禁用?

回答

0

嘗試運行的phpinfo(),以確保國防部重寫被激活。

<?php 
    phpinfo(); 
?> 
+0

嗨,謝謝你的回覆。你是對的'/ usr/lib/apache2/modules/mod_rewrite.so'中的mod_rewrite.so模塊沒有啓用。我修復它,運行'sudo a2enmod rewrite'這使模塊,我也寫在我的'httpd.conf'下一行:'LoadModule rewrite_module modules/mod_rewrite.so'。 – 4gus71n

1

在.htaccess中有+ FollowSymlinks嗎?這通常會在已經激活該選項的Linux系統上或在Windows上執行500錯誤。

+0

不,我已經上面顯示的線是總我.htaccess文件的:在您的Web根目錄文件夾,其中包含 創建簡單的PHP文件。 – 4gus71n

相關問題