0

I have 404s generated for a deleted CSS&JS files and i want to redirect the requests for those files in general. I mean a redirect for all 404 generated for CSS&JS files.

These errors are generated by google crawlers. Please note that those files are generated randomly from a caching plugin WP Fastest Cache which generates different file names on every delete for the cached files.. some times i make some CSS changes so i always have to delete those files.

0

Google crawlers just follow the HTML. If you intend on deleting CSS&JS files, search through all your themes&plugins that were using the files and either comment off or remove the line calling the CSS&JS files.

Look for both wp_register_???() and wp_enqueue_???().

Examples for plugins:

wp_enqueue_style('wp_css_name', plugins_url( '/assets/css/style.css' ... ));

wp_enqueue_script('wp_js_name', plugins_url( 'assets/js/script.js' ...)...);

Example for themes:

wp_register_style('normalize', get_template_directory_uri() . '/normalize.css'...);
wp_enqueue_style('normalize');

With all themes&plugins not calling for nonexistent files, your problem is solved.

  • Thank you for your answer, but i wanted to tell you that those file are generated randomly from a caching plugin which generates different file names on every delete for the cached files.. some times i make some CSS changes so i always have to delete those files. – Mohamed Omar Feb 8 '17 at 19:03
  • Then clear cache every time you delete a file.. – contemplator Feb 8 '17 at 20:38
0

If you just want to put redirects in place quickly, this plugin will let you specify the original url and the redirect url. Not sure if this will help you here, but it's worth mentioning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.