/    Sign up×
Community /Pin to ProfileBookmark

htaccess redirect to cover all bookmarked pages??

I’m launching a new site and need to redirect but don’t want to leave people hanging and wondering why their bookmarks went somewhere else…. i’m looking for some redirect code i could put at the root of the site that will let me set the timer and add copy. what is the best code i can use for this?

PHP
Apache

Thank you.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@grumpyoldtechsFeb 28.2007 — i don't think i understand what you want to do?

you want to do something to their browser bookmarks?

do you just want to redirect someone quickly?

<?php

header("Location: http://www.url.com/");

exit;

?>
Copy linkTweet thisAlerts:
@selyauthorFeb 28.2007 — i want to redirect the entire site, not just individual pages (which some people may have bookmarked). the only redirect code i can find which allows me to set the timer and add copy ... redirects single pages. i'm looking for some code (to put in an htaccess file, perhaps???), that i can place at the root of the site so if anyone has a page other than the home page bookmarked, this page will be shown for 30 seconds and then redirected.

this is the code i'm using now:

<!-- TWO STEPS TO INSTALL TIMED REDIRECT:

  • 1. Copy the coding into the HEAD of your HTML document

  • 2. Add the onLoad event handler into the BODY tag -->


  • <!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Original: [email][email protected][/email] -->

    <!-- Modified: Benjamin Wright, Editor -->

    <!-- This script and many more are available free online at -->

    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin

    redirTime = "40000";

    redirURL = "http://www.fruitsandveggiesmorematters.org";

    function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }

    // End -->

    </script>

    <link href="default.css" rel="stylesheet" type="text/css">

    </head>

    <!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

    <BODY onLoad="redirTimer()">


    thank you for your help
    Copy linkTweet thisAlerts:
    @grumpyoldtechsFeb 28.2007 — by using javascript if someone has it turned off they will still be on the same page.

    but javascript is the only way i know of which might let you do this with the delay.

    as for the .htaccess use the link at the bottom under: Forcing New Requests

    http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

    but the issue lies in the time delay.

    also i found this in the woodworks:

    http://www.webdeveloper.com/forum/showthread.php?t=77345

    bokeh might have the solution for you in that post
    Copy linkTweet thisAlerts:
    @TaschenFeb 28.2007 — Sely, sorry I can't give you a full code snippet, but you need to provide more info. What you want to do is possible with php using header(refresh). However, this isn't the best way as header refresh doesn't send the 301 status code (presuming the webserver you're on is apache) needed for a permanent redirect.

    Also, without knowing anything about your page structure it's hard to give a full answer. If your site has remained the same and only the domain has changed you could simply swap the domain names in the url of header(refresh).

    Anyhow, here' how header refresh should work
    [code=php]header( 'refresh: 5; url=www.mydomain.co.uk/thepageiwant.html' );
    echo '<h1>You will be re-directed in 5 seconds...</h1>';[/code]


    Here are some helpful php functions

    http://uk.php.net/str_replace

    http://uk.php.net/parse_url
    Copy linkTweet thisAlerts:
    @selyauthorMar 12.2007 — is it possible to do a 301 redirect but have a delay?
    ×

    Success!

    Help @sely spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...