Title: Cache redirects?
Last modified: September 1, 2016

---

# Cache redirects?

 *  Resolved [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/)
 * On my sites I have some redirects (301 Moved Permanently) and WP Fastest Cache
   create for such redirects a cache and redirects don’t work when we go to such
   URL again. Example: I use Ceceppa Multilingua plugin and I have slugs for languages
   e.g. [https://mydomain.tld/en/contact](https://mydomain.tld/en/contact). When
   I go to URL [https://mydomain.tld/contact](https://mydomain.tld/contact) then
   it redirect to [https://mydomain.tld/en/contact](https://mydomain.tld/en/contact)
   BUT with WP Fastest Cache it’s doesn’t work.
 * [https://wordpress.org/plugins/wp-fastest-cache/](https://wordpress.org/plugins/wp-fastest-cache/)

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/cache-redirects/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/cache-redirects/page/2/?output_format=md)

 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460013)
 * you need to try exclude page feature for doing it.
 * [http://www.wpfastestcache.com/features/exclude-page/](http://www.wpfastestcache.com/features/exclude-page/)
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460016)
 * **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!
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460017)
 * I feel very confused – I reported a bug and You just rid me off :/
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460028)
 * 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.
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460029)
 * **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.
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460031)
 * And You are wrong, You can check that the site have redirect code and do not 
   cache it.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460032)
 * 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?
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460033)
 * Yep, this plugin redirect by browser language via using wp_redirect() and custom
   slug.
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460101)
 * Any solution?
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460104)
 * 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.
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460105)
 * 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.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460106)
 * 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?
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460107)
 * 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?
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460108)
 * 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.
 *  Thread Starter [Beherit](https://wordpress.org/support/users/beherit/)
 * (@beherit)
 * [10 years ago](https://wordpress.org/support/topic/cache-redirects/#post-7460109)
 *     ```
       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 😉

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/cache-redirects/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/cache-redirects/page/2/?output_format=md)

The topic ‘Cache redirects?’ is closed to new replies.

 * ![](https://ps.w.org/wp-fastest-cache/assets/icon-256x256.png?rev=2064586)
 * [WP Fastest Cache - WordPress Cache Plugin](https://wordpress.org/plugins/wp-fastest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-fastest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-fastest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-fastest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-fastest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)

 * 21 replies
 * 2 participants
 * Last reply from: [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/cache-redirects/page/2/#post-7460157)
 * Status: resolved