Site5 - Built For Designers & Developers MENU
Home  ›  Control Panels  ›  Domains: How to setup Domain Redirects

Domains: How to setup Domain Redirects

24 Comments

The Redirects interface allows you to send all of the visitors of a domain or particular page to a different URL.

For example, if create a page with a long URL, use the Redirects interface to add a redirect from a short URL to the long URL. Visitors can enter the short URL to access the content of the long URL.



 

How to setup domain redirects in SiteAdmin

This demo assumes you’ve already logged in to SiteAdmin

Now let’s see how to setup a URL redirect.

1) Click the Website Tools option from the left menu, then click URL Redirects.

2) Now select the redirect type. A permanent redirect will notify the visitor’s browser to update any bookmarks that are linked to the page that is being redirected. Temporary redirects will not update the visitor’s bookmarks.

3) Select the domain and path you wish to redirect.

4) Enter where you want to redirect to. This is where the user will be sent when trying to access the domain and path you set.

5) Select the  www redirect type. If you use Redirect with or without www then it will redirect the user regardless if they have a www in the url or not.

6) Select if you want a Wild Card Redirect or not. Wild cards will redirect the user, even if they are trying to load a sub-folder of the path you set.

7) Click Add

That’s it!

Example 1) In this example, we have http://site5demo.com/billing redirecting to http://billing.site5demo.com. We selected a Permanent redirect type so that it updates our user’s browser favorites. We also selected the www redirect option so that it is not www sensitive, meaning that it does not matter if they enter www or not. In addition, we also are using a wild card redirect so that if the user was trying to access a sub-folder, it will still redirect them.

Example 2) In this example, we have http://site5demo.com/oldpage redirecting to http://site5demo.com/newpage. We selected a Permanent redirect type so that it updates our user’s browser favorites. We also selected the www redirect option so that it is not www sensitive, meaning that it does not matter if they enter www or not. This is a good way of sending the user to a new/updated page if your web software can’t do it automatically.

Example 3) In this example, we have http://site5demo.com/redirect redirecting to http://site5.com (note that its a different domain). We selected a permanent redirect type so that it updates our user’s browser favorites. We also selected the www redirect option so that it is not www sensitive, meaning that it does not matter if they enter www or not. This is a good way of sending users to another domain or project site.



 

How to setup domain redirects in cPanel

This demo assumes you’ve already logged in to cPanel

Now let’s learn how to setup domain redirects

1) Click the Redirects icon

2) Now select the redirect type. A permanent redirect will notify the visitor’s browser to update any bookmarks that are linked to the page that is being redirected. Temporary redirects will not update the visitor’s bookmarks.

3) Enter the URL that you want to redirect

4) Then enter the destination URL… where you want visitors to be redirected to

5) Click Add

That’s it! The redirect has been created. Now when someone visits the contact.html page, they’ll automatically be redirected to the contactus.html page

6) Click Go Back

From here you can see a list of domain redirects…

… and you can delete them too

The domain redirect has been removed

This is the end of the tutorial. You now know how to setup domain redirects in cPanel



 

How to Redirect Your Domain to a Subfolder Using .htaccess

Sometimes the simple things are the hardest to figure out and today we are going to show you a simple way to redirect your primary domain to a subfolder on that domain. For the purposes of this tutorial it will redirect to a subfolder at /blog. This is useful if your WordPress blog is installed to a subfolder and you want the main domain to forward to it.

In your public_html folder (also called the “root html” folder), you need to create a file called .htaccess

From this file we are going to use a few lines to redirect those requests in a search engine friendly way.

Add the following lines to that file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ blog [L]

The only change you need to make is to change “YourDomain.com” to your domain. This will then redirect everything from the domain to the folder /blog at that domain. If you want to change that folder just edit the “blog” part.

Redirect KB Shortcuts:

For further information on what you can do with a .htaccess file I recommend the following sites…

  • Comprehensive Guide To .htaccess – Scroll to the bottom of the page for 12 tips on things you can do with the .htaccess file. Everything from password protection to redirects to preventing directory listings.
  • .htaccess Cheat Sheet – A nice listing of different tips and tricks to use. Sparse on explanations though (that is why it is a cheat sheet).
  • .htaccess Tools – A great site that has some basic tools online that can generate everything for you. Nice article on how to detect and redirect iPhone users as well.
  • Perishable Press Stuipd .htaccess Tricks – When you finish reading this you will be a .htaccess ninja! 56 pages of easy to read documentation. At least easier to read than the official Apache docs.

Just a word of warning, Apache redirects are often a thing of voodoo magic and for really complex rules you might have to play with them for a while to get them to work how you want.

 

Still have a question? Or need help?
If you need technical support with your account, please email us or chat live with a representative.

24 Comments

  • URL redirect seems to be a fantastic option to redirect url from one to another. The examples given by you gives an impression that this is possible within the same domain only.

    Can I redirect to a different domain url the same way? Say for example to affiliate sites? I would like to get it clarified by you.

    Thanks
    VG

    • Hello,

      Thank you for your comment! I have updated the article with another example to help make this more apparent. You sure can redirect to other domains. Simply enter the full path (including http) of the site/domain you wish to redirect visitors to.

  • I have established a permanent redirect from my primary domain http://www.marketinganswerman.net to my blog platform, which is hosted elsewhere. Is it possible to mask that redirect, keeping the url my primary domain? It is not a phishing expedition, I just would like to keep the “branding” consistent. I know others have done this simply through other hosting providers, from their provided cpanel. I see that it is not offered through my cpanel. Is there a way to do it through the .htaccess file?

    • Hello James,

      I hope this comment finds you well!

      Because of the way htaccess works, you would not be able to do a domain mask. This is due to a security feature in Apache (the web server) to help prevent phishing attacks.

      However, you may be able to use a CNAME in this situation. Because of the way CNAME’s work, it would simply point to that site and the only thing they would see is your domain. You mentioned you are hosting that site elsewhere, you may need to contact them to find out if that would work on their setup or if you would need to change anything on their end to allow it to work.

      For information on how to setup a CNAME, please see the following link…

      http://kb.site5.com/control/siteadmin/siteadmin-simple-dns-editor/

      If you have any questions, please feel free to leave a comment here, or if you would prefer, you can open a ticket with our support department through Backstage.

      Happy Hosting!

  • How can i redirect my web page to a rails application running o localhost:3000?

    • Hello Alejandro,

      I hope this comment finds you well!
      Could you please provide us with more information about what you are attempting to accomplish?

      Unfortunately on all of our managed services, applications cannot listen on ports and from the information you provided us, that’s what you appear to be attempting.

      However, it could easily be done on our unmanaged VPS product line once it becomes available. For more information, please see the following link…

      http://www.site5.com/vps/unmanaged/

      If you are not trying to have your application listen on a port, please let us know and we will attempt to find a solution that works for you.

      I look forward to your reply!

  • Hello! I’ve followed the directions above, but the domain that I wish to redirect (which I’ve purchased and is listed within my registered domains list) is not an option in the drop-down menu on the URL Redirects page (step #3 above).
    Any suggestions on how to get it there?
    Thanks!

  • Hi, I wanted to redirect to the www version. For example, I wanted to redirect mysite.com to http://www.mysite.com.
    Should I use this method to do this?
    I checked off “Wildcard Redirect” but noticed that it said, “You cannot use a Wild Card Redirect to redirect your main domain to a different directory on your site.” But it seems to have worked. Right now if I go to mysite.com, it redirects to http://www.mysite.com.

    Also I went to your other page http://kb.site5.com/domains/how-to-set-your-domain-to-redirect-to-www-by-default-in-the-htaccess/
    I added that code to my htaccess but it didn’t do anything, so I un-did it. Is there more than one htaccess file? I don’t understand why it didn’t work.

    • Hello Andrew,

      You can use this method to complete the redirect you wish, yes. Simply adjust the rule and the target accordingly :)

      Regarding your question about .htaccess, there really only needs to be one, in public_html, but having others is fine as well. If you have a .htaccess in public_html it will apply its rules to public_html and all subfolders. If you add a .htaccess to a subfolder, however, it will take precedence for that subfolder, and every subfolder beneath it.

  • Nevermind….I tried the htaccess method again and I think it works now. There was probably a lag taking effect before. Next time I’ll wait 1 minute to see if my changes go in effect.

  • Hi there. I set up an url redirect as described above. I am redirecting http://www.havenholde.net/35footspear to http://www.35footspear.com. However, it does not appear to be working. I have waited several minutes and dumped my browser cache in case it was a caching issue, but it’s still not working. How long should one have to wait until the redirect is active?

    The 35footspear directory being redirected is a Drupal site, if that makes any difference.

    Thanks,

    Drea

    • Hi Drea,

      I am sorry to hear of the troubles you are having with this. It should be fairly straightforward to do this, but adding Drupal to the mix can make things a little more confusing.

      I would recommend you contact our support team via a ticket, which you can enter from BackStage, to have a closer look taken at this.

    • Hi Joe,

      While .htaccess files are recursive through subfolders, the redirect you have set should work normally. As it is not, try this instead of a redirect:

      DirectoryIndex /sub1/sub2/index.php

  • We are running a contest and the signup page is on the website of a third party.

    I’m trying to redirect a short link, bensonsbuildingsupply.com/football to the signup page : http://touchpointgames.com/bensons-building-supply-football-contest/about/?s=1&cm=584z-CoGU

    but whenever I try the bensonsbuildingsupply.com/football all I get is my “page not found”

    Gunar

    • Hi Gunar,

      There could be a few things causing this. Have you contacted our support team to take a look? We would be happy to dig into this for you, and get the redirect working.

  • Hi there,

    I have an issue with my main domain. If I use the .htacess to redirect to a subfolder inside public_html I get the folder name as a suffix, resulting in an ugly url. To explain, if I do redirect from http://www.mysite.com to public_html/mysite.com then my url looks like this : http://www.mysite.com/mysite.com/index.php

    For my other parked domains, I use the cpanel to redirect them to a folder, and doing so does not result in that ugly URL.

    Is there anything I can do to correct this ?

    • Hi Tarek!

      That is not a problem at all. Since some redirect .htaccess directives could use some slight tweaking to work perfectly with addon domains that are in subfolders. The best option here would be to submit a ticket through your backstage panel and our Customer Service staff will be glad to find the best .htaccess directives that would redirect your site without duplicating the domain name.

  • Trying to create 301 redirects from old pages to new site/domain pages.

    Tried the old-fashioned .htaccess page – standard syntax:
    redirect 301 /old_page/ http://newdomain.com/new_page

    I got “500 Internal Server Error”

    SO…

    I tried the same thing via SiteAdmin Panel. URL Redirects accepted BUT do not work.

    Any answers?

    Thanks!

    • Hi Mark,

      That redirect syntax should work, so there is something else causing the error. I would recommend you contact our support team, and they can investigate this for you.

  • I think that the default redirect in SiteAdmin should be 302 rather than 301.

    A client recently set a redirect while his site was in development, and then distributed the URL to the site’s target audience. Unfortunately the redirect was 301 rather than 302. Now that the site has launched, removing the redirect does not remove it from the browsers that have already cached it.

    At the very least, SiteAdmin should include Cache-Control and Expires headers so that the browser cache checks back in once in a while to see if the 301 is still valid.

    • Hi Cliff!

      Thanks for the great suggestion! Either redirect option would work without any problems and we encourage anyone setting these up to try different settings to find what works best for them.

Money Back Guarantees