PDA

View Full Version : Htaccess Files - Have Question



squabbles
04-26-2008, 05:42 PM
This following code does NINETY percent of what I need it to.

I've tried for DAYS to fix, but I can't get there.

(People from here and other forums have had ideas-- but their code fixes 1 or 2 things, then causes other issues. Or, sometimes, it doesn't work at all.)

- Our pages from our LOGON Primary Domain, and ADDON Domains, unintentionally show as duplicate pages, with various URLs.
So: ONE.com is your primary Log-On account, TWO.com is your ADDON Domain.

You'll have pages show (where you don't want them to) for:
one.com/two
one.two.com
two.one.com
ETC

** THIS CODE *A*L*M*O*S*T fixes that.
- Putting THIS in my MAIN LOGON domain's .htaccess (the one in Public_html):
Redirect 301 /two http://one.com

** In the directory for TWO.com (just named "TWO"), I add THIS to that .htaccess file
RewriteCond %{HTTP_HOST} ^two.one.com$ [NC]
RewriteRule ^(.*)$ http://one.com/$1 [R=301,L]

The result:
All possible unwanted URL combos are done away with. (There are a couple 404's -- but they're REAL 404's per the Header: I had been re-directing to "/404.shtml" but that creates something an engine could cache and index.)

Also: With this code, my subdomains still work the way the should, etc.

Anyway:
There's ONE URL this DOESN'T work for:
one.two.com
which throws a "CAN'T LOCATE SERVER" error

(In FIREFOX, it says "Firefox can't find the server at one.two.com")

There IS no header information, so it's NOT a 500.

* 1) Is there any reason to be concerned about this? (As far as I know, this URL is un-cachable. The error gives no info as to the domains being related. Plus, it's a hybrid, weird URL, unlikely to ever be tried -- except possibly by a spambot.)

2) If this looks like a problem, anyone have any suggestions how to tweak the code?
(Remember, a small change in an .htaccess may cause the URLS I've dealt with, to become active again, or my SUBDOMAINS not to work etc.)

Thanks everybody.