PDA

View Full Version : htaccess problem on vb 4.1.8


temsamane
12-07-2011, 12:38 PM
i have a htaccess file:

# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On

# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /

#RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
#RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]



i want to change my .htaccess so i can increase page speed (browser cache)

i want to use this one:

# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On

# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /

#RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
#RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]


Header unset ETag
FileETag None
Header unset ETag
FileETag None
# BEGIN Gzip
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
# END Gzip
# removes some bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
# Setting (up) will be overite by the following...

# 10 Year
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|txt)$">
Header set Cache-Control "max-age=315360000, public"
</FilesMatch>
# 10 Year
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=315360000, must-revalidate"
</FilesMatch>
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>

<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf|css|js)$">
Header set Expires "Wed, 21 May 2012 20:00:00 GMT"
</FilesMatch>

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

## 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 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 2 days"
</IfModule>
## EXPIRES CACHING ##

but when i use this last htaccess, then the users cant log out. If he log out and refresh the page, he will be logged in again.

how can i solve this problem?

kh99
12-07-2011, 05:40 PM
I don't know much about htaccess files, but I think the problem might be this:

ExpiresDefault "access 2 days"


I think that might cause it to tell browsers to cache all file types not mentioned above it (including html) for 2 days.

TheLastSuperman
12-07-2011, 05:57 PM
Yes I concur because I've seen a simple .htaccees edit bring down entire sites and anything dealing w/ the cache unless you know what it does do not include as it can cause issues... integrated sites for example those that use Wordpress and vBulletin... using the W3 Cache Plugin for wordpress in a situation where it's been integrated can cause issues among other things. Also it's not well advised to have a huuuuuge .htaccess file either, just a heads up ;).

Be very very careful about "Optimizing" your site by yourself, if your not careful (experienced or not) you can actually mess something up.

Edit: Also if your ever in doubt, rename .htaccess and then check the site, if your using vBSEO then yes it will seem funky but for example if you edited your .htaccess then uploaded and noticed after refreshing the forums style was all white w/ blue links and no images or backgrounds... well there's your sign it was the edit you just included in .htaccess so now undo that edit and re-upload and your back in business!

Lynne
12-07-2011, 06:11 PM
Yep, I have seen several tickets where users add that code without knowing what it does and then breaking their site.

Please don't just add something to your site without actually looking it over and understanding what it does.