iWeb Tip #20 – Redirect Pages in iWeb

15
7586
Redirect Pages in iWeb

Redirect Pages in iWebRedirect pages in iWeb

This tip shows you how to redirect a page to another page.  There are many instances where you might find you’ll need to redirect one page to another and this tip will show you how.  One example might be if you are using iWeb built in auto navigation and you want one of the links to actually go to an external page.  Another example may be that you’ve posted a page and many people are linking to that page from other sites, so you need to keep the same page up to keep the link, but you actually want to redirect them to another page.


So here is how to redirect your page to another page:

1) Go to the page that is going to be the redirect page.
2) Add an HTML Snippet onto your page and paste this code:

<script type="text/javascript">
parent.location.replace('https://yoursite.com/yourpage.html');
</script>

3) Then simply change the URL in the code to the page you want the page to be redirected to.
4) Then hit apply and your set.  You’ll find that once you publish your site and visit that page it will automatically redirect to the page you specified in the code.

Sometimes you want to redirect to another page after some time.  For example if you are redirect a user to another site you could send them to one of your pages that says something like “You are now being redirect to AnotherSite.com” then after 3 seconds or so it automatically directs them to the page.  To do that do the same steps as above, but simply paste this code below in an HTML snippet.

<script type="text/javascript">
var url ='https://yoursite.com/yourpage.html';
var delay = 3;
var d = delay * 1000;window.setTimeout('parent.location.replace(url)', d);
</script>

Then specify the URL and how long you want the redirect to delay and you’re set.

Hope that helps.

15 comments

  1. Ashley 23 March, 2010 at 10:16 Reply

    First, thank you for this site – it’s been a huge help!

    I have a WordPress.com blog that I want to integrate into my site. I currently have the site in an iFrame but am wondering if it would be cleaner to simply redirect visitors to the actual WordPress blog? Does anyone have any experience with this? I don’t want my whole iWeb site to be hosted on WordPress, just my blog to be integrated into my iWeb site (hosted elsewhere).
    Thanks!

  2. Spikey8D 23 May, 2010 at 12:29 Reply

    Hi, this might be a bit different, but I would like to redirect first time viewers to a Welcome page, but otherwise have past users go to the news/blog page.
    I was thinking I would have to use cookies, and maybe put the code in the index.html file…
    Know how I could do this?
    I’m using iWeb 09

  3. Vincent 1 August, 2010 at 03:17 Reply

    Thank you so much I wanted my website to be redirected to my tumblr and this works perfectly. One problem, it works in Firefox and Google Chrome browsers… but for some reason it doesn’t work with Safari. It gives me the Oops BS. Any suggestions you may be able to help me with. I would appreciate it. thanks again

    Vincent

  4. Doug 21 May, 2011 at 16:54 Reply

    I was wondering what the additional code would be to open the “go to” site in a new window? BTW this site rocks! Thanks for all the help!

    Cheers

    Doug

  5. Ed 9 June, 2011 at 22:10 Reply

    This redirect does not always work – fine on the iMac, not working on the iPad or IE.

    The old site is AgentDealerCRM.com

    Redirect to AgentDealer.com

  6. marketing online 16 March, 2012 at 18:03 Reply

    My brother suggested I would possibly like this web site. He was entirely right. This publish actually made my day. You can not imagine simply how a lot time I had spent for this information! Thanks!

  7. Amazingrobie 27 April, 2012 at 00:29 Reply

    What script do you use to redirect mobile browsers to your mobile site instead of the full site. I realize I’m a little late to the iWeb game, but it really does still fit my purposes. Thanks in advance.

  8. Randall 22 February, 2013 at 13:18 Reply

    I would like to insert a textbox in an iweb page which would navigate the user to another page in the site based on his input to the textbox. I assume this will be a snippet/widget and I am prepared to learn some applescript or javascript or whatever (how bout some Fortran!! That’s what I started to learn!) if it isn’t too far off the chain. Thanks for this easy-to-use site!

  9. Phil Law 20 October, 2016 at 14:16 Reply

    This site was created in iWeb and I am now using Everweb to create my site.
    I have read your direction to add the text illustrated above. My question is where does it go, and how to I get there.
    I am great at reading with in a program. I have never seen or done any coding.
    Your solution to the problem looks easy but how do I go about doing it.

    Thanks Hopefully you can help. Phil

    • iwebunlimited 31 October, 2016 at 04:49 Reply

      In EverWeb you can select the page you want to redirect and go to the Inspector->Page Settings (first tab) and scroll down to the Header/Footer field. Place this code in the Header field.

Leave a reply

Recommended

Facebook
Twitter
YouTube