Support » Fixing WordPress » I wish to block hits to /blog/index.php/index.php

  • Resolved hetta


    I get a few /blog/index.php/index.php?paged=18 requests a week; the relative links to other parts of my site all return 404s if clicked from such an URL.

    How do I block these, serve them a 404 right off, or send them to /blog/index.php?… ?


Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use a rewrite rule to rewrite

    blog/index.php/index.php?… to blog/index.php?…

    (I’m just typing, this is close, but probably not exactly correct)

    RewriteRule ^/blog/index.php/index.php(.*)$ /blog/index.php$1 [R]

    Good idea, but for some reason .htaccess rewrite doesn’t work on my site (which is why I don’t have pretty permalinks).

    Can I add some .php to wp-blog-header.php?

    I tried putting this right after <?php in wp-blog-header.php, but that did nothing at all:
    if (strpos($REQUEST_URI, 'index.php/index.php') > 0) { exit; };



    if (strpos($_SERVER[REQUEST_URI], 'index.php/index.php') > 0) { exit; };

    You may have just been using the above code for testing/troubleshooting, but if you weren’t, exit; may be a bit too extreme of an action to take. Maybe you could just redirect them to the main index.php

    if (strpos($_SERVER[REQUEST_URI], 'index.php/index.php') > 0) {
    header("Location: \n\n");

    If you chose to do it this way, you’d want to make sure this is one of, if not the first lines of code in index.php.

    Many thanks! Pasting that right after <?php in wp-blog-header.php
    did the trick.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I wish to block hits to /blog/index.php/index.php’ is closed to new replies.