我已經添加根.htaccess
文件瀏覽器緩存,網站上多個域的工作/像子域:www.domain.com
,mt.domain.com
,rt.domain.com
和相同的代碼使用的所有網站。我已經使用Codeigniter
框架htaccess的使瀏覽器緩存只有子域名網站
現在caching
開啓所有域/子域,是有可能,我可以緩存
.htaccess
文件
<IfModule mod_rewrite.c>
RewriteEngine On
########### TODO: deploying on subdir must rewrite this
RewriteBase/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Options -Indexes
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 seconds"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
添加特定的域/子域
感謝您的幫助
您是否可以訪問'httpd.conf',更具體地說是您的'VirtualHost'還是唯一的選項是'.htaccess'?你的apache,2.2+或2.4+版本是什麼? – Prix 2014-09-17 06:36:13
我可以訪問'httpd.conf',而且apache使用的是'2.2'版本' – Girish 2014-09-17 08:43:20
感謝您的回覆,我已經創建了一個虛擬主機''通配符子域,因爲子域名站點不是固定的,這些發佈/從網站管理員發佈..我想申請緩存所有子域網站和跳過網站管理員(域名)緩存,但問題是主站點和子域網站代碼相同..我們可以使用另一個' .htaccess'爲子域**(*。domains.com)**,任何運氣。 –
Girish
2014-09-17 19:18:13