Forum Moderators: phranque
then in which .htaccess file i should use? The .htaccess of root domain or in the .htaccess of sub-domain ? Or on both .htaccess? I have two separate .htaccess for root and subdomain on their respective directory.
Can you get to the subdomain's index page on purpose-- that is, by typing its full address instead of being rewritten from something else? If so, do the links behave any differently if you got there one way or the other? Same thing for any interior pages.
Try this. Put a RewriteRule in your subdomain's htaccess that says something like
RewriteRule garbage\.html {some path that's supposed to work} [R=301,L]
For the first part, make up a nonsense name-- something that doesn't really exist. For the second part, pick a file and path that do exist, but don't write out the full [subdomain.example.com....] Instead just use a leading slash.
Do you end up on your 404 page? Look at your browser's address bar and see what it says.
it was displaying 404.php page which is again different from the root domain's 404.php page (By design and text message).
I tried to access http:\\news.example.com\abc.html , it was displaying 404 page. Also the url changed into http:\\news.example.com\login
(We'll assume for the sake of discussion that the backslashes in your last paragraph are typos for regular front-slashes ;))
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^login$ user_login.php Is it handled with some kind of <directory> instruction in the main htaccess?
If you request "primarydomain.com/somegarbage" does it give you the primary 404 page?
Matter of fact, there's an ongoing thread elsewhere in this forum where the poster's new domain flatly refuses to use the custom 404.
From the code above, you have no RewriteRule associated with your three RewriteConds.
The three RewriteRules also have no conditions attatched to them.
Conditions only ever apply to the single following RewriteRule. So if the same conditions apply to more than one rule, the conditions must be restated before each rule.
RewriteCond <whatever>
RewriteCond <whatever>
RewriteCond <whatever>
some other code
RewriteRule <whatever>
RewriteRule <whatever>
RewriteRule <whatever> RewriteCond <whatever>
RewriteCond <whatever>
RewriteCond <whatever>
RewriteRule <whatever>
RewriteCond <whatever>
RewriteCond <whatever>
RewriteCond <whatever>
RewriteRule <whatever>
RewriteCond <whatever>
RewriteCond <whatever>
RewriteCond <whatever>
RewriteRule <whatever>