0
I installed the wp plugin super cache for wordpress on the server and it’s working fine. But I can’t understand why my rules on . htaccess does not work for the homepage.
I rewrite the requests pro Ubdomain www to a folder with a wordpress installation, www/. htaccess:
# www (blog)
RewriteCond %{HTTP_HOST}% ^www\.domain\. [NC]
RewriteCond %{REQUEST_URI} !^/wp_inspiracoes/
RewriteCond %{REQUEST_URI} !^/index\.php/
RewriteCond %{REQUEST_URI} !^/css/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/fonts/
RewriteCond %{REQUEST_URI} !^/img/
RewriteRule ^(.*) /wp_inspiracoes/$1 [L]
# Rewrite all other URLs to index.php/URL (in house app)
RewriteRule .* index.php/$0 [PT]
And at www/wp_inspiracoes/. htaccess:
RewriteBase /
#full page cache
RewriteCond %{DOCUMENT_ROOT}/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/$1index-https.html -f
RewriteRule ^(.*) "/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/$1index-https.html" [L]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
These rules work for accesses like www.domain.com/some-post/ and www.domain.com/other-post/ and rewrites to the statistic local files generated by wp super cache plugin:
.../wp-content/cache/supercache/www.domain.com/index-https.html
.../wp-content/cache/supercache/www.domain.com/algum-post/index-https.html
.../wp-content/cache/supercache/www.domain.com/outro-post/index-https.html
But they DO NOT work for www.domain.com (homepage), which should rewrite for .../supercache/www.domain.com/index-https.html
So I tried some homepage-specific rules on www/wp_inspiracoes/. htaccess (before the general cache rules but they didn’t work):
# homepage rules
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{DOCUMENT_ROOT}/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/index-https.html -f
RewriteRule ^(.*) "/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/index-https.html" [L]
# full page cache here
I tried several rules for home but they didn’t work either:
# homepage rules
RewriteCond %{DOCUMENT_ROOT}/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/index-https.html -f
RewriteRule ^$ "/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/index-https.html" [L]
# full page cache here
Even these rules in www/. htaccess (before the rules rewriting www to wp_inspiracoes folder) also did not work
> RewriteCond %{HTTP_HOST}% ^www\.domain\. [NC]
> RewriteCond %{REQUEST_URI} ^/$
> RewriteCond %{DOCUMENT_ROOT}/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/index-https.html
> -f
> RewriteRule ^(.*) "/wp_inspiracoes/wp-content/cache/supercache/%{SERVER_NAME}/index-https.html"
> [L]
>
> # www to /wp_inspiracoes rules here
If anyone can please help me with these rules, to work for both homepage (/) and posts (/some-post) Duvida_sobre_htacces_SO_ptBR.txtAbrir Showing Duvida_sobre_htacces_so_ptbr.txt.
There is a very strange text there in the question, are you sure you did the right copy/Paste?
– brasofilo