2014-03-31 52 views
0

我對Apache很新。我閱讀和閱讀文檔,把我發現的所有conf文件,但...URL重寫爲了使用joomla SEF

雖然我在網絡服務器上的根,我讀到,爲了優化apache2,它不是一個好主意,使用.htaccess文件(http://httpd.apache.org/docs/current/howto/htaccess.html)。

好的,我讀了很多關於url_rewriting和htacess的howtos。我想這個代碼到我的www.site.com虛擬主機文件:

<VirtualHost *:80> 
    ServerName site.com 
    ServerAlias www.site.com 
    ServerAdmin [email protected] 
    DocumentRoot /var/www/www.site.com 
    RewriteEngine On 
    <directory /> 
      RewriteBase /var/www/www.site.com/ 
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
      RewriteCond %{REQUEST_URI} !^/index\.php 
      RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|$ 
      RewriteCond %{REQUEST_FILENAME} !-f 
      RewriteCond %{REQUEST_FILENAME} !-d 
      RewriteRule .* index.php [L] 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride None 
      Order allow,deny 
      allow from all 
    </Directory> 
    <Directory "/usr/lib/cgi-bin"> 
      AllowOverride None 
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
      Order allow,deny 
      Allow from all 
    </Directory> 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    LogLevel warn 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

請注意,RewriteBase已經與DocumentRoot的值進行測試和「/」,以及所有的RewriteCond來最新的Joomla的形式std_htaccess!源代碼。

的Apache2啓動順利,該網站是沒有錯誤的在線觀看,但改寫未正常工作的Joomla SEF不工作:( 我完全以輸了...再次...我需要你的幫助球員!

回答

0

好的,正確的方法是

<directory /var/www/www.site.com/> 
       RewriteEngine On 
       RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
       RewriteCond %{REQUEST_URI} !^/index\.php 
       RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC] 
       RewriteCond %{REQUEST_FILENAME} !-f 
       RewriteCond %{REQUEST_FILENAME} !-d 
       RewriteRule .* index.php [L] 
       Options FollowSymLinks 
       AllowOverride None 
     </Directory>