JosephSilber / page-cache

Caches responses as static files on disk for lightning fast page loads.
MIT License
1.21k stars 118 forks source link

Caching page from file does not open #55

Closed mmg071 closed 2 years ago

mmg071 commented 4 years ago

Good afternoon.

Laravel 7 / Mamp PRO / Apache

I did everything according to the instructions, cache files are created successfully. But upon repeated access, the page cache file is not opened, but simply a new file is recreated.

Please tell me what can I do wrong?

I assume that the case is in htaccess file. Here are its contents: `

Options -MultiViews -Indexes
RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Serve Cached Page If Available...
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/page-cache/pc__index__pc.html -f
RewriteRule .? page-cache/pc__index__pc.html [L]
RewriteCond %{DOCUMENT_ROOT}/page-cache%{REQUEST_URI}.html -f
RewriteRule . page-cache%{REQUEST_URI}.html [L]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# редирект на без www
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule .* http://%1/$0 [L,R=301]

# редирект с index.php на корень
RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 

`

champkris commented 3 years ago

Any update to this case?

this-user-name commented 2 years ago

I have the same issue with apache, the files are created in each request, but never served. I was looking foward to try this :/ After a closer look, in the online server it works. Problem : When running php artisan serve in local development, for some reason the public/.htaccess file is not being hit by the request. Strange.

JosephSilber commented 2 years ago

The .htaccess file contains Apache directives.

php artisan serve uses PHP's built-in server, not Apache.