Are You kidding me?! One of my website have ~300 posts and ~420 pages so for each one I must set exclude – it’s imposible. Anyway, it’s simple to check when wp_redirect() is executed and do not cache page/post with redirect. And I don’t inderstand why Your plugin cache URLs where we have got 301 code!
I feel very confused – I reported a bug and You just rid me off :/
My god 🙂 How can WPFC detect the redirection in htaccess? You can set the exclude rule and WPFC does not do anything about the page.
This is not redirections in htaccess but via wp_redirect() function. And is not simple to set exclude rule – please write how can I exclude URLs without /pl/ and /en/ on start.
And You are wrong, You can check that the site have redirect code and do not cache it.
ow now I got it. I did not read your explanation proplery, sorry. You use Ceceppa Multilingua for doing it. How does it redirect? Browser language?
Yep, this plugin redirect by browser language via using wp_redirect() and custom slug.
There is no solution. The plugin owner needs to make this plugin to be compatible with cache plugins. The static html file is created when the page is cached so php and mysql does not work. He needs to redirect the page with javascript instead of php.
Thanks for answer but no such solution is expected. It is really simple to do fix on your plugin site – just check the page status before cache it. Such fix was in WP Super Cache. Optional You can hook on wp_redirect and check the source page and do not cache it.
If a page has been cached, how can I hook the function? If the page shouldn’t be cached, why do you use a cache plugin?
Emre, this page have 302 code so it’s redirection. What is the sense to cache page with? Just tell me. I use a cache plugin to cache other page. What do you not understand?
I created a simple fix, so don’t tell it is not possible to fix it (cache.php):
public function callback($buffer){
(...)
}else if($this->checkHtml($buffer)){
}else if($this->checkHtml($buffer)){
return $buffer."<!-- html is corrupted -->";}
else if(http_response_code()!=200){
return $buffer."<!-- test -->";
}else{
(...)
I just add to function callback a checking of response code. Ofcourse there we can check only code 301, 302 etc.
else if(http_response_code() == 301 || http_response_code() == 302){
return $buffer;
}
This will be okey. Please add it to function callback in cache.php.
P.S. You have a lot of white spaces in code 😉