• I would like a page link from my blog redirect to my static website. You know how you can create a page and the link will appear on the blog. I would like it to go directly to my static website.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Just change the hyperlink source to your static website address

    See if anything in this thread, or the links in it, are of any help:

    https://www.ads-software.com/support/topic/248486?replies=7

    Hi,

    You can write an redirection code in .htaccess file of your domain.

    Redirect /wordpress/index.php https://www.domain.com

    Thanks,

    Shane G.

    Thread Starter storm_law

    (@storm_law)

    What I want to do is create a wordpress page that will in turn creat a link on the blog, but I want that link to go to my static website rather than the wordpress page.

    Any way to do this?

    Any way to do this?

    Yes.

    The link I already posted for you above, leads you to more than one solution.

    What I want to do is create a wordpress page that will in turn creat a link on the blog, but I want that link to go to my static website rather than the wordpress page.

    Here is a solution that I have used successfully, but you should of course, choose whatever solution is best for you.

    1) Create a new empty page template. Name it whatever you want. For this example we’ll call it mywebsite.php. Save your new blank template as mywebsite.php. It must have the .php extension.

    2)Open your new blank page template in a plain text editor. Inside of it, paste the following code:

    <?php
    /*
    Template Name: mywebsite
    */
    ?>
    <?php header('Location: https://www.mywebsite.com');
          die();
    ?>

    I am told that it is important not to leave any white space in front of the <?php.

    3) Now change the template name information to reflect the actual name of your new template, and change the url to reflect where you actually want it to take you when you click on the page.

    4) Upload your new page to to your current theme folder. Create a new page on your blog, name it whatever you like, and apply your new page template to the page and publish it.

    Now when you click on that page in your header navigation, it will take you to whatever url you put in the template. I’m sure there are several ways to do this. I know this way works because I’ve done it several times… just recently on WP 2.7.1. …and the whole process takes about three minutes.

    Good luck to you.

    thank you! this worked perfectly for me ??

    You are most welcome. I’m glad to see someone other than myself has had success with it!

    ??

    Thanks, Clayton. I just found you solution and it’s sooooo simple. I needed to redirect a tab to a shopping cart site and it’s working great. SUPER!

    Using this method, how would you open the link in a new window, such as you would with the onclick="window.open(this.href); return false;" or target="_blank" ?

    Worked for me too; needed a link to an action on a page and worked perfectly! Thanks!

    You could avoid the white space issue by removing the unnecessary tags..

    ?>
    <?php header('Location: https://www.mywebsite.com');

    for..

    header('Location: https://www.mywebsite.com');

    Bit silly closing PHP ?> only to then open it again straight after <?php

    You could also look at using the WordPress redirection function in place of the header location..

    wp_redirect('someurl', 301);

    301 is the status code to use, and of course someurl is where you’d place your URL to reirect to.. (301 is default, so not required unless you want a difference status code)

    You should also place an exit call after the redirect…

    header('Location: https://abc.de'); exit();

    or

    wp_redirect('https://abc.de'); exit();

    jannmirch

    (@jannmirch)

    It’s a thing of beauty! I thought I’d be trying to figure this out for hours and I did it in a matter of minutes.

    I needed to create a child page under “newsroom” that was really a link to an existing child page of “About Us.” Your simple redirect works perfectly.

    Thanks.

    yay! glad i found this, as i had a request to put a “Next Blog” loop in some related blogs, using the top page nav, thusly. the template solution posted by ClaytonJames solved it handily! thank you =)

    dustybacon

    (@dustybacon)

    Very thankful for all the great solutions! Please though, a little more technical support?

    I think I might need a timed-redirect page that redirects after one or two seconds …

    This is because I spend a lot of time promoting my site on social media (FB), I’d like a dummy re-direct page that I can attach a link of instead of my front page. If I link to my front-page it will display a blurb of the uppermost text and the images from the posts on the front-page. I want to be able to have a dummy page that redirects quickly but that has the right text and pics for such a blurb. I’ve coded pages with the redirects in this thread and they actually redirect within the link I’m attaching (ie in the facebook message I’m sending) thus defeating the point of the dummy re-direct page for my purposes. Hope I’ve been clear. Any help is appreciated ??

    Nice! I’ve done this a couple of different ways such as simply using an HTML redirect but I really like this technique, particularly because it creates a template that you can package with custom themes. Thanks!

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘How do I make a page redirect to my static website?’ is closed to new replies.