Redirecting from wp-content?

If you have access to your .htaccess file, try the following RewriteEngine On RewriteRule ^(Your_Artile_Name)\.pdf your_article.php [L,R=301] Substituting your actual file names for ‘Your_article_name’ and ‘your_article’. If you have a Microsoft server, this article explains how to convert .htaccess to web.config

How to redirect just one or two blog posts correctly?

First, make sure that Rewrites are enabled for your server, then add this to your .htaccess file in WordPress’s root directory… RewriteRule your-old-page-permalink/ http://www.yoursite.com/your/new/permalink/ [R=301,L] This is a greedy match, so your-old-page-permalink/ just needs to correspond to the old post’s SLUG (that’s the editable part of the permalink on your post edit screen). So, go … Read more

!is_admin() condition turns true in admin pages

redirecting not logged in user is the only thing that works 🙂 in the backend. What you are describing is very peculiar. template_redirect is a front-end hook. Your code will never run on the backend, as far as I can tell. You can demonstrate that with this line: add_action(‘template_redirect’,function() {die;}); You can traverse the back-end … Read more