2011-05-22 18 views
16

.htaccess dosya içeriğini apache2'nin bir vhost dosyasına taşıdığımda performansın artırılıp artırılamayacağını merak ediyorum..htaccess içeriğini vhost'a taşıyın, performans için

Bu benim .htaccess sankon bildiriminde ben içeriğin üstüne koymanız gerekir bunu yaparken iyi bir fikir ise

Options +FollowSymLinks +ExecCGI 

<IfModule mod_rewrite.c> 
    RewriteEngine On 

    RewriteCond %{SERVER_NAME} ^([^.]+\.[^.]+)$ [NC] 
    RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] 

    # we check if the .html version is here (caching) 
    RewriteRule ^$ index.html [QSA] 
    RewriteRule ^([^.]+)$ $1.html [QSA] 
    RewriteCond %{REQUEST_FILENAME} !-f 

    # no, so we redirect to our front web controller 
    RewriteRule ^(.*)$ index.php [QSA,L] 
</IfModule> 

, içeriği nedir?

Teşekkürler!

cevap

10

Eğer vhost yapılandırma dosyalarını düzenleme imkanınız varsa, bunu her zaman yapmalısınız. .htaccess sitenize yapılan her istek ile yorumlanırken, vhost.conf sadece httpd restart/reload üzerinde yorumlanır.

Sen Directory-direktifi içinde Options ayarlayabilirsiniz - örneğin:

<Directory /usr/local/apache2/htdocs/somedir> 
Options +FollowSymLinks +ExecCGI 
</Directory> 

<VirtualHost [...]> 
[...] 
RewriteEngine On 

RewriteCond %{SERVER_NAME} ^([^.]+\.[^.]+)$ [NC] 
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] 

# we check if the .html version is here (caching) 
RewriteRule ^$ index.html [QSA] 
RewriteRule ^([^.]+)$ $1.html [QSA] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f 

# no, so we redirect to our front web controller 
RewriteRule ^(.*)$ index.php [QSA,L] 
</VirtualHost> 

Ayrıca apache.org bu wikipost bakmak - özellikle bölüm ben, ben .htacces kullanmamalısınız ne zaman Dosyalar?