4

Is it possible that I set-up a redirect of my store which is located at www.xyz.com/store to store.xyz.com .

Do i have to buy a new domain name or is there any other way.

1
  • 1
    "aliases or redirects" - "aliases" and "redirects" can mean something very different. Your question would seem to be referring to a "redirect", not an "alias".
    – MrWhite
    Jun 9, 2015 at 7:22

3 Answers 3

7

You most certainly do not have to buy store.xyz.com as a new domain name. store.xyz.com is a part of xyz.com

A domain name is made up of multiple parts

www.google.com

www.google.com
 |    |     | --- domain name extension 
 |    | --- domain name
 | --- subdomain

mail.google.com

mail.google.com
 |     |     | --- domain name extension 
 |     | --- domain name
 | --- subdomain

Your ownership of the domain name entitles you to unlimited subdomains, but your webhost may choose not to let you create them. (In fact, you already have one subdomain, www.xyz.com) Your web host / domain name registrar may also attempt to trick you into paying for subdomains.

The specifics of how to set up a subdomain vary depending on your hosting configuration.

For GoDaddy:

  • Next to the hosting account you want to use, click Manage.
  • In the Domains section, click Subdomains.
  • Complete the following fields, and then click Create:
    • Subdomain — Enter the subdomain you want to use for one of your hosted domain names.
    • Select the domain name for which you want to create the subdomain.
    • Document Root — Enter the directory you want to use as the root directory for the subdomain's website, or use cPanel's default.

Quoting Godaddy's page on Managing Your Hosting Account Subdomains

(For other people who see this answer other than the OP and are not on GoDaddy): To redirect /store to this subdomain , see the other answers.

5
  • Thanks for clearing the doubts about domain and sub domain.
    – bradar93
    Jun 10, 2015 at 7:01
  • I bought my web hosting from GoDaddy. Domain name from GoDaddy. Starter Linux hosting with cPanel. I didn't buy them together but separately.
    – bradar93
    Jun 10, 2015 at 7:02
  • OK. I am busy now, but I try to get back to you later today
    – Daniel F
    Jun 10, 2015 at 19:37
  • @AbhiAvana Alright, I updated my answer with GoDaddy specific instructions.
    – Daniel F
    Jun 13, 2015 at 21:54
  • Domain/Subdomain is more complicated than that. If I give you www.sante.gouv.fr, what is the domain and the subdomain? Same for just dk (try in your browser, it works), or www.springfield.k12.or.us Jan 22, 2021 at 3:26
2

The easiest ways to do a redirect in order from the old-fashioned method to the best method is as follows:

Code snippet 1

saved as index.html in the document root of the old URL.

<html>
<head>
<title>Redirecting</title>
<meta http-equiv="refresh" content="1;URL=http://store.xyz.com">
</head>
<body>
<p>Loading new page</p>
</body>
</html>

It works but the experience is rather slow because the digit in the content value of the meta tag is the number of seconds before the refresh actually happens.

Code snippet 2

saved as index.html in the document root of the old URL.

<html>
<head>
<title>Redirecting</title>
</head>
<body>
<p>Loading new page</p>
<script type="text/javascript">
window.location.href="http://store.xyz.com";
</script>
</body>
</html>

This method is faster, but the user needs javascript enabled in their browser.

Code snippet 3

saved as index.php in the document root of the old URL.

<?php
header("HTTP/1.1 301 Moved Permanently",true);
header("Location: http://store.xyz.com",true);
?><html>
<head>
<title>Redirecting</title>
</head>
<body>
<p>Loading new page</p>
</body>
</html>

In this last snippet, I did add extra HTML but most browsers would pick up the HTTP headers and automatically do the redirection quickly.

Pick any snippet and add a link pointing to the new URL just incase the automatic redirection does not work in any particular web browser. Some web browsers can be very buggy.

11
  • 1
    The problem is, they are asking to how acquire store.xyz.com and then host the content of /store at store.xyz.com. How are you answering their question at all? Downvoting
    – Daniel F
    Jun 10, 2015 at 4:52
  • The other steps to the process has been answered by other users. I'm adding a very important step to complete the process. Without this step, no redirects will take place. Jun 10, 2015 at 4:56
  • Ok. I didn't know that was acceptable, but you have much higher rep than me so I will assume that you are knowledgeable about this.
    – Daniel F
    Jun 10, 2015 at 5:00
  • 1
    Ok. I am still not sure about this, so I asked a question on meta. Just wanted to let you know that it is at meta.webmasters.stackexchange.com/questions/1357/…
    – Daniel F
    Jun 10, 2015 at 5:18
  • 1
    Sometimes answers are well formed by multiple people. Its like putting the missing pieces of the puzzle together to form the grand solution. Ok. Now this comment may deserve a -1 for not being on topic to the question. Jun 11, 2015 at 0:27
-2

For the sake of SEO, and maintaining your pages' rank, you may want to permanently redirect the old URLs to the new ones. Here's the Google documentation on redirects.

4
  • You don't really answer the question.
    – Zistoloen
    Jun 10, 2015 at 8:39
  • This might have been better as a comment to one of the other answers. You are right in your comment. A 301 redirect is best and it appears that point was not made. I often update an answer I have written based upon a comment and give a nod to the user for their contribution in case the comment is later deleted. Thanks for chucking in! Cheers!!
    – closetnoc
    Jun 10, 2015 at 23:40
  • Sueneu, The OP wanted to actually implement a redirect between two domains, but the answer you presented explains why redirecting is better. Jun 12, 2015 at 17:06
  • Mike, glad to help, Zistoloen, would adding this as a comment to another answer have been appropriate?
    – sueneu
    Jun 15, 2015 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.