Redirect URL while building site

Let me write a plugin for this (save as wp-content/plugins/red_visitors.php): <?php /** * Plugin Name: Redirect visitors * Plugin URI: http://wordpress.stackexchange.com/questions/138519 * Author: still_learning */ // function based on http://stackoverflow.com/a/5892694/2948765 // I hope it still works function __is_login_page() { return in_array($GLOBALS[‘pagenow’], array(‘wp-login.php’, ‘wp-register.php’)); } // When WP is ready… add_action(‘init’, function() { // Check what … Read more

WordPress Logout Redirect Follow up

It looks like you’re addressing me 😉 If you want to modify this code snippet: add_action( ‘wp_logout’,’go_home’ ); function go_home(){ wp_redirect( home_url() ); exit(); } you can replace the home_url() part with your custom page URL: ‘http://example.com/landingpage/’ but I wouldn’t recommend hardcoding the landing page, if it’s an internal page. You can try to construct … Read more

Hide page for user logged and redirect for profile? [duplicate]

Not tested but should work add_action(‘wp’, function() { $url = home_url(‘my-profile/’); // profile url here if(is_user_logged_in()){ if(is_front_page() || is_home()){ wp_redirect($url); exit; } } }); Edit: I hooked into wp so the functions in the conditional will work. Add the above snippet of code to your child theme’s functions file, after you edit the $url on … Read more

How to Show different page URL instead of default home page URL

You could try an HTML Redirect. Copy your header.php and rename to header-redirect.php and include this code: <meta http-equiv=”refresh” content=”0; url=xyz.com/test/test1″ /> Then create a page template called page-home.php and include this code: <?php /* Template Name: Home */ ?> <?php get_header(‘redirect’); ?> <p>Please wait, you are being redirected</p> <?php get_footer(); ?> Set your hompage … Read more

How can I redirect foreigners by IP to other URL in WordPress?

You could try using: http://ipinfodb.com/ip_location_api.php Send a get with the incoming ip adress and based on the response redirect it to a different part of your website. $request = new WP_Http; $result = $request->request( ‘http://api.ipinfodb.com/v3/ip-country/?key=<your_api_key>&ip=74.125.45.100’ ); I hope this helps.

Why my htacess rewrite return 404?

I am assuming that the stuff in “def/products” is not handled by WordPress. Try reversing the index.php and abc/products rules, like so: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^abc/products-(.+)$ def/products-$1 [R=301,L] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wp/index.php [L] </IfModule> .htaccess is read and executed … Read more