Wildcards with Wordpress?

3 replies
I am trying to find a way to install a wordpress plugin that redirects ALL PAGES to the main domain. The redirect plugins I find in the search want you to specify the URL that is being redirected. I don't want to do that. I want ALL URLS to be redirected (A WILDCARD). How do I do this with wordpress? I can't seem to get a clear answer on this and every other forum talks around it in circles. Thanks.
#wildcards #wordpress
  • Profile picture of the author PRBandit
    It depends. Do you want robots to still read the pages? If you do you want to use javascript if you want to redirect and tell google that the contents of that page have moved to the home page, you want to use php

    PHP
    Code:
    if(Array['REQUEST_URI']!="index.php"){
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.usite.com/index.php" );
    }
    Javascript
    Code:
    if(window.location !="index.php"){
    window.location = "index.php";
    }
    if you need help implementing these just reply here. I tested the javascript but not the php.
    {{ DiscussionBoard.errors[4377332].message }}
  • Profile picture of the author SteveJohnson
    Why in the world would you want to do that? Writing a plugin to do it would be pretty straightforward, but why?
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[4378510].message }}

Trending Topics