Wordpress Redirect page

I search several times but I couldn't find nothing that really helps me.

Basically I have a very VERY simple Theme which is working very well.

I also have a database with some IP's and depending by this IP I need to redirect the guest to different pages.

So on my template index.php file I added:

if ($country == "br") { 
    echo "case1";
} else {
    $location = bloginfo('template_url')."/index-nbr.php";
    echo $location;

    ?>
       <script type="text/javascript">
          window.location= <?php echo "'" . $location . "'"; ?>;
       </script>
    <?php
}

I tried many different ways to redirect but none of them work. Could someone help me with this stuff?

Solutions

Ok let me make your life easier.

Just install this plugin you will find a text box on the bottom of every page in PAGES section in Admin panel where you can put your desired link/URL of the page and that will redirect you to your inserted URL.

Page Link to Plugin

Similar questions

Wordpress Redirect Specific User. Tired of Peter's redirect Plugin its not working
I was trying this since 2days still not a good answer. Tired of Peter's login its not working. I want to redirect a specific User (Like "John" or someone) to a specific Page. its a hidden one i want only him to access that when he logged. i have managed to add the wordpress login on a page.i want them to login via that.Would be very happy if someon...
Force Wordpress https redirect before www redirect based on site address url
The default web address for a domain is: If I set this as the 'Site Address (URL)' in Wordpress then it seems to take care of the necessary http -> https and non-www -> www redirection on it's own. The problem is though is that Wordpress redirects the following first: Before this one: Which means that our HSTS preload status and eligibility is fail...
htaccess experts: Redirect all but root to one TLD, redirect root to another TLD - WordPress
Help from the gurus is appreciated. I have been requested to put a client's WordPress homepage on one TLD (i.e. domain.eu), and have all other pages/directories be 301'd to a different TLD extension (i.e. domain.com/everything-else). Not sure why this is being requested, but apparently it's important to the client, and I've been banging my head to ...
.htacess custom redirect rules conflicting with Wordpress redirect rules
I am in the process of moving my current static site to Wordpress, using the same domain name. Both old and new sites have their content in the root folder and also have identical file names, but on the new (Wordpress) site, I have removed the .php extension that exists on the current site and added a trailing slash, as per Wordpress permalinks. So...
Redirect only WordPress homepage with a 301 redirect
I have a blog, lets say example.com and another blog installed in example.com/np which is not multisite but a different WordPress installation. What I want is to redirect example.com homepage only to example.com/np. It would be great if that redirection is a 301 moved permanently redirection. If I place the 301 redirection in WordPress header file,...
WordPress: .htaccess E8 redirect with permalinks. conditional redirect?
In WordPress, I set the page URL to be the post name via permalinks. The issue is I want to redirect ALL Internet Explorer 8 pages to a page called ie/. The issue is there are 2 .htaccess redirects. I have dug around and found a ton of Internet Explorer 8 redirects, but no conditional for my needs.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.