Direct my Main Domain Name to a subfolder

Discussion in 'DNS/Domain names' started by Tom Leogrande, Nov 21, 2019.

  1. My main site is - let's say ABC.com hosted at WinHost.com

    On my hosting account I installed Wordpress to a subfolder off the root called ABC .

    ABC.com tries to open from the root folder. How and where do I go about pointing the domain name to the proper folder on the server?

    Thanks!
     
  2. After doing some reading on this forum on other threads - am I reading this correct in that I cannot simply point my Domain Name directly to a subfolder?

    From what I can read I need to use redirect scripts? Am I missing something or is this the only way it can be done on WinHost.com. I am testing to move all my hosting (4 shared server plans) and over 100 domains from another hosting site to something new. I am trying WinHost - but if all my sites will need to be pointed to the root folder and then redirected to the subfolder - that could be a show stopper. Pointing a website to a subfolder on my previous hosting account took about 30 seconds and did not use a redirect script.
     
  3. Elshadriel

    Elshadriel Winhost Staff

    Yes, you cannot point a domain name directly to a folder. You will need to use URL Rewrite. We provide a guide here.
     
  4. Yes - That is what I was afraid of. Google doesn't like that very much.... I was hoping I could simply point the Domain to the sub-folder - as I mentioned before, I am trying to get away from another host for many reasons - but they handle this pretty well.

    Thanks for the information!
     
  5. ComputerMan

    ComputerMan Winhost Staff

    By default all domain pointers and subdomain names point to the root directory of the site account by default. In order to redirect the domain name or a subdomain name. You can use the URL Write rule to redirect the domain name

    I'll explain in further detail because I know those URL Write rules can be a little tricky.

    For redirecting a domain pointer you can use this:

    Replace the following with your domain name ABC.com .

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
     <system.webServer>
      <rewrite>
       <rules>
        <rule name="abc.com" stopProcessing="true">
         <match url=".*" />
         <conditions>
          <add input="{HTTP_HOST}" pattern="^(www.)?abc.com" />
          <add input="{PATH_INFO}" pattern="^/abc/" negate="true" />
         </conditions>
         <action type="Rewrite" url="\abc\{R:0}" />
        </rule>
       </rules>
      </rewrite>
     </system.webServer>
    </configuration>
    The above code will redirect ABC.com to the subdirectory \abc but in the URL you will only see ABC.com

    Important! This rule needs to go into the web.config file located in the root only.

    If you need help just contact our support department. I'm sure we can help you out.
     

Share This Page