uri上的mod_deflate问题没有尾部斜杠

时间:2014-05-13 06:26:28

标签: php .htaccess symfony mod-deflate trailing-slash

我想让mod_deflate在我的网站上运行。一切正常:对于css,js等文件,mod_deflate正在工作。 当我去主办/城市/,它也工作正常。但是,当我打电话给主人/城市时,它不起作用。但我想使用uri而不用斜杠。

项目正在Symfony2框架上运行。

我收到此响应标头(在主机/城市上):

HTTP/1.1 200 OK
Date: Tue, 13 May 2014 06:14:08 GMT
Server: Apache
Cache-Control: no-cache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

这些适用于主持人/城市/:

Cache-Control:no-cache, max-age=21600
Connection:Keep-Alive
Content-Encoding:gzip
Content-Type:text/html; charset=UTF-8
Date:Tue, 13 May 2014 06:16:58 GMT
Expires:Tue, 13 May 2014 12:16:58 GMT
Keep-Alive:timeout=15, max=100
Server:Apache
Transfer-Encoding:chunked
Vary:Accept-Encoding

我使用以下.htaccess:

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-shockwave-flash
</IfModule>

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 5 minutes"
ExpiresByType image/ico "access plus 8 days"
ExpiresByType text/html "access plus 6 hours"
ExpiresByType image/jpg "access plus 8 days"
ExpiresByType image/jpeg "access plus 8 days"
ExpiresByType image/gif "access plus 8 days"
ExpiresByType image/png "access plus 8 days"
ExpiresByType application/x-javascript "access plus 8 days"
ExpiresByType text/javascript "access plus 8 days"
ExpiresByType application/javascript "access plus 8 days"
ExpiresByType text/css "access plus 8 days"
ExpiresByType text/xml "access plus 2 days"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On

#<IfModule mod_vhost_alias.c>
    RewriteBase /
#</IfModule>

RewriteCond %{HTTP_HOST} ^(www\.)?otherwebsite\.com [NC]
#RewriteCond %{REQUEST_URI} !^/app/(.*)
RewriteCond %{REQUEST_URI} !^/app
RewriteCond %{QUERY_STRING} !.*\is_app=([^&]*).*
RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [L,R=301]

RewriteRule ^mywebsite/(.*)$ /$1 [L,R=301]

RewriteRule ^mywebsite http://www.mywebsite.com [L,R=301]

# Remove trailing slash of URLs except for .../app/
RewriteCond %{REQUEST_URI} !^.*app/$
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=303,P]

# redirect requests without any subdomain to www.
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]


</IfModule>

有什么想法吗?非常感谢你!

0 个答案:

没有答案