Closed mlg1 closed 4 years ago
I also forgot to add the .htaccess file.
# Serve Cached Page If Available...
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/page-cache/%{HTTP_HOST}/pc__index__pc.html -f
RewriteRule .? page-cache/%{HTTP_HOST}/pc__index__pc.html [L]
RewriteCond %{DOCUMENT_ROOT}/page-cache/%{HTTP_HOST}%{REQUEST_URI}.html -f
RewriteRule . page-cache/%{HTTP_HOST}%{REQUEST_URI}.html [L]
RewriteCond %{DOCUMENT_ROOT}/page-cache/%{HTTP_HOST}%{REQUEST_URI}.json -f
RewriteRule . page-cache/%{HTTP_HOST}%{REQUEST_URI}.json [L]
This would break all existing caches.
If you want this in your project, you can easily extend the built-in Cache
class, and overwrite that method :+1:
You can also do it setting a different path depending on domain at boot on AppServiceProvider
Look here https://github.com/JosephSilber/page-cache/issues/74#issuecomment-883701867
Hello, By changing one line, functionality can be added to use the plugin with different domains.
In the file src/Cache.php on line 198:
- $segments = explode('/', ltrim($request->getPathInfo(), '/'));
+ $segments = explode('/', ltrim($request->getHost() . $request->getPathInfo(), '/'));
It has been tested on Laravel 7 and it works for me. Is it a good idea? Is there something I'm missing?