Mobile app version of vmapp.org
Login or Join
Pierce454

: How to setup htaccess to show new posts on WP site? I'm using VPS CentOS + Apache + Wordpress. Not using any Cache plugin but htaccess instead. All work good except my home page wont refresh

@Pierce454

Posted in: #CacheControl #Htaccess #Wordpress

I'm using VPS CentOS + Apache + Wordpress. Not using any Cache plugin but htaccess instead. All work good except my home page wont refresh if I write new post. Only new visitors can see new posts.
This is htaccess I currently use. Please take a look and give me advice. Let's say to refresh homepage every 1 hour?
#Force WWW + SSL #RewriteCond %{HTTP_HOST} !^www.example.com #RewriteRule (.*) www.example.com/ [R=301,L]
#RewriteCond %{HTTPS} !=on
#RewriteRule ^/?(.*) %{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} =on
RewriteRule ^/?(.*)$ %{HTTP_HOST}/ [L,R=301]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# Compress text, html, javascript, css, xml
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

<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>

<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 7200 seconds"
ExpiresByType image/jpeg "access plus 7200 seconds"
ExpiresByType image/png "access plus 7200 seconds"
ExpiresByType image/gif "access plus 7200 seconds"
ExpiresByType application/x-shockwave-flash "access plus 7200 seconds"
ExpiresByType text/css "access plus 7200 seconds"
ExpiresByType text/javascript "access plus 7200 seconds"
ExpiresByType application/javascript "access plus 7200 seconds"
ExpiresByType application/x-javascript "access plus 7200 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>

# 480 weeks
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

# 2 DAYS
<FilesMatch ".(xml|txt|php)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>

# 2 HOURS
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=600, must-revalidate"
</FilesMatch>

FileETag None

SetOutputFilter DEFLATE

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4.0[678] no-gzip

BrowserMatch bMSIE !no-gzip !gzip-only-text/html

SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary

# Disable server signature
ServerSignature Off

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce454

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme