Redirect to "Coming Soon" page on Wordpress site

Asked

Viewed 113 times

0

I am developing a site in Wordpress and did not want to be adding any plugin "Coming soon" (soon) as I already have a page for this to replace my homepage.

What I want to know is if it is possible to redirect to this page any user who enters my site by another link.

  • When you say "any user entering my website via another link", what that would be "another link"?

2 answers

0

  • 1

    You can also use the wp_redirect() if it is only a temporary redirect use the 302 status, but if it is permanent you can use the 301.

0

There are several ways to do this in Wordpress using PHP, as shown here

//redirecionar nao-administradores
function pagina_em_breve()
{
    global $pagenow;

    if((!is_user_logged_in() || !current_user_can('manage_options')) && !is_page("login") && !is_page("em-breve") && $page_now != "wp-login.php")
    {
        wp_redirect(home_url("em-breve"));
        exit;
    }
}
add_action('template_redirect', 'pagina_em_breve');

Or it is possible to use the .htaccess to redirect any IP other than yours to that page:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.89$ # <-- seu IP
RewriteCond %{REQUEST_URI} !em-breve\.html
RewriteRule ^(.*)$ /em-breve.html [R=302,L] 

Do not forget to put replace by your IP on !^123\.45\.67\.89$

Browser other questions tagged

You are not signed in. Login or sign up in order to post.