How to Redirect a URL to Another URL?

12 replies
I have two blogs about web design and hosting, now I am wanting to create a page like these pages

Code:
https://forumweb.hosting/top-quality-best-web-hosting.html
http://www.webhostingsecretrevealed.net/choose-the-right-web-hosting/
the design for my page is going to be complete, just a small problem is I want to create a redirection for my url like this

for example, when I click on the link

/go/unidenhosting
/go/hostbastic
...

then it will be redirected to targeted site.

What methods do I need to do to have that?


Thanks in advance.
#redirect #url
  • Profile picture of the author timokeefe
    Ideally you'd have a 301 response at the server level, but how you set that up will depend on what your stack is.
    Signature

    I'm part of the Warrior Forum team, hit me up with any suggestions that could help improve the forum!

    {{ DiscussionBoard.errors[11125086].message }}
    • Profile picture of the author freetriffac
      Can you share this code?
      I would like to test on my real site and see how it works.
      {{ DiscussionBoard.errors[11125665].message }}
  • Profile picture of the author David Beroff
    Code:
    <?php header( "Location: https://forumweb.hosting/top-quality-best-web-hosting.html" ); ?>
    Signature
    Put MY voice on YOUR video: AwesomeAmericanAudio.com
    {{ DiscussionBoard.errors[11125999].message }}
    • Profile picture of the author freetriffac
      Originally Posted by David Beroff View Post

      Code:
      <?php header( "Location: https://forumweb.hosting/top-quality-best-web-hosting.html" ); ?>
      Thanks David, I will check it out.
      but how to create this url structure:..../go/websitename/ ?
      {{ DiscussionBoard.errors[11126235].message }}
  • Profile picture of the author David Beroff
    If it is just a few redirects, it's easiest to just do it manually:
    Create the directory /go/ .
    Create the directory /go/websitename/ .
    Add the file /go/websitename/index.php which has the above PHP code.

    If it's more than a few dozen, what I do is use an .htaccess to convert the "directory" to a URL parameter, and then the (single) index.php goes to the database to convert that to the desired redirect. I also capture the click's IP address, country and referring URL back to the database, as long as I'm at it, but that's of course optional.
    Signature
    Put MY voice on YOUR video: AwesomeAmericanAudio.com
    {{ DiscussionBoard.errors[11126375].message }}
    • Profile picture of the author freetriffac
      Originally Posted by David Beroff View Post

      If it is just a few redirects, it's easiest to just do it manually:
      Create the directory /go/ .
      Create the directory /go/websitename/ .
      Add the file /go/websitename/index.php which has the above PHP code.
      Seem this way is less automatic but it is easier for me to do.

      Originally Posted by David Beroff View Post

      If it's more than a few dozen, what I do is use an .htaccess to convert the "directory" to a URL parameter, and then the (single) index.php goes to the database to convert that to the desired redirect. I also capture the click's IP address, country and referring URL back to the database, as long as I'm at it, but that's of course optional.
      I am doing according to this way and found some tutorials on Google about this.
      Thanks for let me know it is possible to do.

      Btw, I am checking their forum https://forumweb.hosting/ , are you David Beroff on Top post leaders?
      {{ DiscussionBoard.errors[11126647].message }}
      • Profile picture of the author David Beroff
        Originally Posted by freetriffac View Post

        Seem this way is less automatic but it is easier for me to do.
        Exactly!

        Originally Posted by freetriffac View Post

        I am doing according to this way and found some tutorials on Google about this.
        Thanks for let me know it is possible to do.
        Yip.

        Originally Posted by freetriffac View Post

        Btw, I am checking their forum https://forumweb.hosting/ , are you David Beroff on Top post leaders?
        No. It's funny: his father called me when he was born, to give me a heads-up that I was no longer alone with that name.
        Signature
        Put MY voice on YOUR video: AwesomeAmericanAudio.com
        {{ DiscussionBoard.errors[11127819].message }}
        • Profile picture of the author freetriffac
          Originally Posted by David Beroff View Post

          Exactly!

          Yip.

          No. It's funny: his father called me when he was born, to give me a heads-up that I was no longer alone with that name.
          You are pretty interesting, its funny if the world has 2 David Beroff only.
          {{ DiscussionBoard.errors[11129592].message }}
  • Profile picture of the author Mashetty Sandeep
    I think this is also working propery.
    <?php echo "<script>window.location = URL;</script>" ?>
    {{ DiscussionBoard.errors[11136926].message }}
  • Profile picture of the author freetriffac
    Originally Posted by Mashetty Sandeep View Post

    I think this is also working propery.
    <?php echo "<script>window.location = URL;</script>" ?>
    Originally Posted by help121 View Post

    Go public-html folder in your cpanel and create index.php file and paste
    This code.
    https://forumweb.hosting/top-quality...b-hosting.html
    I think everythink will be fine.
    Thanks
    https://www.fiverr.com/nnalam/do-any...with-wordpress
    Thanks Mashetty and help121, I will try these ways but to be honest I succeeded with the way that David Beroff suggested.
    {{ DiscussionBoard.errors[11139582].message }}
  • Profile picture of the author techugo
    You can setup a URL redirect to forward your domain (http://yourdomain.com) or sub domain (http://www.yourdomain.com) to any destination page of your choice Usually, when you set up a URL redirect for a domain, it takes 15 minutes to take effect.
    {{ DiscussionBoard.errors[11140713].message }}
  • Profile picture of the author gabrielusa
    why can't you use hyperlink like this
    this will go to google
    hyper link you can use on you blog page
    by using <a href=""> html tag on your website
    {{ DiscussionBoard.errors[11140914].message }}

Trending Topics