Redirect a post or page to another URL

I have a few vanity URLs on my sites that I use to forward a URL to a particular page deeper on my website and wanted to maintain that feature on WordPress/SB You.  A Google search revealed

From this link: http://stackoverflow.com/questions/7320145/html-redirect-within-body-tags

The following was suggested:

If you can use Javascript, something like this should help you:

<script type="text/javascript">
    window.location = "http://www.google.com/";
</script>

 

In SB You, on a post or a page, if you switch to the Text tab in the editing window, you can add the javascript into your post.  It is important to do this from the Text tab, as this will maintain the code needed to forward your page over.

If you visit http://somas.stonybrook.edu/tropical you will be redirected to the Tropical Marine Ecology webpage located at http://you.stonybrook.edu/tropical

EDIT 2015-12-21:  One extra bonus here is that on my old web server, user folders were listed with a ~, but WordPress removes the ~ when processing the URL.  Setting up the forwarding on the WordPress site with a page without the ~ is much easier due to this “feature”.

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *