0

Apparently there is a .htaccess file in my root directory which is messing up all of my other sites that are in the directory.

I am currently using GoDaddy as my host.
This is the situation i am facing:

  • I have a main domain which is hosted directly in the root folder
    (ex. the index file would be found at /root/index.php)
  • I have some other domains hosted in folders inside the sub-directories
    (ex. root/domain2/index.php)
  • the other websites work correctly.
  • the main domain is built with concrete 5, the rest is built by basic php and html, using notepad++
  • subdomains for the other domains are not working since they do not have access in the .htAccess file
  • Now my question is that,
    Since I cannot erase the .htAccess file, how could I manage making the subdomains?
    The .htaccess file is used only for the concrete website but is controlling everything for some reason, is there any way to fix it?

    Thanks!

    P.S. I was not the one building the concrete website, i was building the rest of the domains, so i do not clearly know how to use it. All i know is that once i erase the .htaccess the subdomains are working and the main domain in the root directory only allow to visit the index page of it.

    Just to be clear, There is a main site, lets call it site 1, which is hosted in the main directory, and there are the other sites, ex. site2-site5, Which i want to make subdomains for and it is not working unless i erase the .htaccess file.

    I hope the question is clear enough, if not and more details are needed, please tell me.

    Baruch
    • 1,618
    • 5
    • 23
    • 42

    1 Answers1

    1

    .htaccess files, by design, impact the directory they are placed in and all directories below them see http://httpd.apache.org/docs/2.2/howto/htaccess.html#what.

    With your current setup, you could create a new .htaccess in the htdocs folder for each subdomain and it would override the one higher up.

    Even better would be to serve the main domain and the subdomains from different parent directories. For example, say your current site is www.example.com, and your subdomains are site1.example.com and site2.example.com.

    I suggest something like this for your directory setup:

    /var/www/example.com/www/htdocs 
    /var/www/example.com/site1/htdocs
    /var/www/example.com/site2/htdocs
    

    This way, what is in use for www.example.com has no impact on site1.example.com.

    This would also prevent the possible duplicate content issues you'll face with having subdomains inside the primary domain htdocs folder.

    For example, if your current setup is like this:

    /var/www/example.com/www  <-- main doman
    /var/www/example.com/www/site1 <-- site1.example.com
    

    Then going to www.example.com/site1 would show you the same content as going to site1.example.com, which would be a negative SEO signal to google.

    bradym
    • 4,880
    • 1
    • 31
    • 36
    • Thanks, but i have a problem though, if you are using godaddy like me, for some reason, probably since it is the main domain that i bought hosting for and the other domains are just using the hosting, I cannot change the main domain's folder. It is automatically in the root folder, so all of my other domains (subdomains and domains) are located in subfolders inside the root. is there a way to change that? and one more thing, you said that i can create another .htaccess file that will overwrite the others, what would be the easiest and most minimal file that i can write as htaccess? Thanks! – Baruch Oct 20 '12 at 19:21
    • .htaccess is a plain text file, so just use any plain text editor (notepad on windows, for example) to save an empty file as .htaccess, then upload it to the site1 folder. That would prevent all settings from the above .htaccess from having any impact. You could then add settings you want for site1. I've never used godaddy so I can't help there. – bradym Oct 20 '12 at 19:25
    • Thanks! It worked! Also, +1 for seo tips :) – Baruch Oct 21 '12 at 04:21