Instalei o plugin wp super cache pra wordpress no servidor e está funcionando bem. Mas não consigo entender porquê minhas regras no .htaccess não funcionan para a homepage.
Eu faço rewrite das requisições pro subdominio www pra uma pasta com uma instalação do wordpress, 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]
E no 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
Essas regras funcionam para acessos como www.domain.com/algum-post/ e www.domain.com/outro-post/ e faz rewrite para os arquivos locais estaticos gerados pelo 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
Mas NÃO funcionam para acessos no www.domain.com (homepage), que deveria fazer rewrite pra .../supercache/www.domain.com/index-https.html
Então eu tentei algumas regras específicas pra homepage no www/wp_inspiracoes/.htaccess (antes das regras de cache geral mas nao funcionaram):
# 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
Tentei várias regras pra home mas também não funcionaram:
# 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
Até mesmo essas regras no www/.htaccess (antes das regras que faz rewrite de www pra pasta wp_inspiracoes) também não funcionaram
> 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
Se alguém puder por favor me ajudar com essas regras, pra funcionar tanto pra homepage (/) quanto pros posts (/algum-post) Duvida_sobre_htacces_SO_ptBR.txtAbrir Exibindo Duvida_sobre_htacces_SO_ptBR.txt.