Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Thanked 0 Times in 0 Posts

    Please help write some JavaScript - URL redirects with rewrites

    Hi there,

    I hope someone can help me.

    I'm porting a blog from an extrememly restrictive provider onto a self-hosted solution. I don't want to lose bookmarked direct traffic and inbound links. The trouble is the restrictive blog provider doesn't allow server-side scripting or access to .htaccess files.

    I've come up with an ingenious way of redirecting the traffic using a find and replace feature on the blog provider. I just need a script that will do the trick.

    I need to:

    1. Take the URL the page is on... (aychttp://blogname.swagblogs.com/my_weblog/2008/09/crappy-name.html)
    2. ...and replace the base with my new domain... (aychttp://www.goodblog.com/2008/09/crappy-name.html)
    3. ...then lose the .html extension... (aychttp://www.goodblog.com//2008/09/crappy-name)
    4. ...then send the browser onto the new URL


    1. I intend to replace instances of </p> with <script type="text/javascript" src="scriptname.js"></script>, so really I need the script to still work when there are multiple instances of it on the same page.
    2. The .html extension may not always be present

    Can anyone help me please? I realise this is cheeky but I'm at my wit's end with this crappy blog hoster and I regret ever going with them!

    Thanks in advance

  • #2
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Thanked 69 Times in 69 Posts
    <script type="text/javascript" charset="utf-8">
    that would redirect them on page load i suppose... not sure if that's really what you're wanting.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts