Page 1 of 1

Need help on root domain and subdomain htaccess

Posted: Thu Nov 03, 2011 12:43 am
by dev07
Hello everyone,

I have root domain [http://www.example.com] and a subdomain [http://news.example.com] . All files of root domain are kept in the root directory. It also includes the folder "news" which is used for the subdomain.

I am hosting my site from godaddy and i made the subdomain from the control panel and pointed the news folder for this subdomain.

I have a .htaccess file for root domain inside the root directory and another .htaccess file for sub-doamin inside the news folder.

The following code is written on the root domain's .htaccess :

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

ErrorDocument 404 /404.php

RewriteRule ^signup$ registration.php
RewriteRule ^login$ index.php
RewriteRule ^home$ index.php


On the other hand, the sub-domain's .htaccess is empty. Previously, above similar code was written. But that time, it was showing Internal server error. So, made it empty.

Few page names of root and sub-domain are same like registration.php, header.php, footer.php, content.php while some other pages are different by name. I have two separate 404.page for root and subdomain.


All the pages of my root domain can be accessible using http://www.example.com/signup and so on.
But the pages of sub-domain is not accessible using http://news.example.com/signup . Its displaying the custom 404.php page of subdomain which is different in design and content from the root domain's 404.php page. If i type http://news.example.com , its opening the index.php and displaying its content. If i type http://news.example.com/registration.php , then its displaying the content of sub-domain's regis

If i type, http://news.example.com/garbage or http://news.example.com/garbage.html then also its displaying the sub-domain's 404.php page.

Can anybody help me on this? Or guide me to write the .htaccess for root and sub-domain? I want to access all the pages of sub-domain with different name (different from the php page name) like the root domain.


Thanks in advance.

Re: Need help on root domain and subdomain htaccess

Posted: Fri Nov 04, 2011 11:57 pm
by dev07
Please help me friends..

Trying to figure out the issue and fix it , but i am failing to do so..

Re: Need help on root domain and subdomain htaccess

Posted: Sat Nov 05, 2011 3:26 am
by uday8486
Hi dev07!
First checkout whether your subdomain is working fine without htaccess files. Looking at your question http://news.example.com/garbage.html is the file garbage.html present in your subdomain path?

Re: Need help on root domain and subdomain htaccess

Posted: Sat Nov 05, 2011 4:39 am
by dev07
uday8486 wrote:First checkout whether your subdomain is working fine without htaccess files.
Without the htaccess file (of subdomain , kept the htaccess of root domain), if i want to access http://news.example.com is opening the index page (i.e index.php) . If i want to accesss other pages like http://news.example.com/login.php or http://news.example.com/registration.php, the pages are opening respectively. But if i type http://news.example.com/login or http://news.example.com/signup , its opening the content of 404.php page .


uday8486 wrote:Looking at your question http://news.example.com/garbage.html is the file garbage.html present in your subdomain path?
No, there is no file named garbage.html inside subdomain ( named "news") folder. not even in the root folder.