CMS Forum CMS Forum
October 07, 2008, 12:40:19 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: << Main Site   The CMS Forum is now live. Post a question - answer someone's query - tell us some CMS news. Some things on this forum can't be seen till you login. Anyone can register & login.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Subdomains / htaccess (re: Doonee)  (Read 1262 times)
rolygate
Administrator
Acolyte
*****
Posts: 14


WWW
« on: March 26, 2008, 06:20:41 PM »

Doonee

Quote
These two sites are seen as completely different sites:
comics.site.com
site.com/comics
.........
Therefore all your search rank etc will be split across what is essentially 2 domains.
.........
"Not if he also permanently redirects from site.com/comics to comics.site.com, right
?"


Well - that's an interesting question. You could do this in the past and though I haven't tried it in the last year or so, I believe Google is too sophisticated now to allow you to transfer PR to different domains.

[note: here, page rank = for any search engine; PageRank = just G]
[note: URLs have gaps so they don't get linked - remove the gaps]

You can't transfer PR from www. site1.com to www. site2.com. Since www. stuff.example.com and www. example.com (or in this case www. example.com/stuff/) are two different domains (from Google's point of view), I would hazard a guess that PR transfer won't work even with redirects.

It may work in the short term - who knows - but it is not something you would want to base long-term strategy on. If you get a different domain, you start again - and a subdomain is a different domain. The DNS is different, it points directly into that subdomain; so it is best to think of it as a separate entity.

You are looking for an htaccess script to redirect a subdirectory to a subdomain, I believe; but that is a mistaken concept in the first place, for most businesses. It's how we did it in the past but everything has changed now. For example people used to use www. blog.example.com - but no one would do that now, it has to be www. example.com/blog/, as the subdomain is entirely separate and has its own PR - none of which transfers across to the main domain.

I don't think rigging up some redirects will fix PR in either direction here - Google is not that stupid. You can redirect your traffic if you change from one to the other, but I wouldn't bank on transferring your PR with it.

Mind you I could be wrong as I haven't tried this for a year or so - subdomains died 2 - 3 years ago so this is old news. You have to have very good reasons indeed now to use blog.example com or forum.example.com - and page rank isn't one of them, it's a negative for that.


Come back to me if you still need a script  Smiley
Logged
dee
Acolyte
*
Posts: 6


« Reply #1 on: March 31, 2008, 01:38:07 AM »

hi

thanks for the clarifications ...

Quote
Come back to me if you still need a script

guess i still do.
in this case here, theres no intention to transfer PR involved, its a matter of multi-language management.
btw. its fresh site, to test SEO functionality issues anticipating possible client requests.
so no harm done as far as your legitimate concerns go.

say joomfish produces domain.com/english and domain.com/spanish.
id like to rewrite these into english.domain.com and spanish.domain.com
and of course also to redirect permanently for the subdirs to the sundomains.

joomla lacks decent management of multiple installations, another reason to investigate on the subject.

so far, im still trying to come to terms, techncially, with the fact that the subdirs in question were created by sh404 and would need to be re-rewritten, so to speak, using htaccess. is that possible ?

thanks again
dee


Logged
rolygate
Administrator
Acolyte
*****
Posts: 14


WWW
« Reply #2 on: March 31, 2008, 02:09:05 AM »

Hi Dee,

I'll dig out a script. I thought I had one but it turns out to be the other way round - from subdomain to directory - because that's what we tend to do more, repairing all that old stuff where people had subdomains.

Now we get down to the question of dirs. created by a rewrite in the first place. Having a chain of rewrites is bad news and there comes a point when G says "enough - you can't do that". And that number is very low, only 2 or 3 times depending. So it can happen that G rejects 2 rewrites as being over the top. (they put a notice in your account: "Warnings" and tell you to fix it. You get a greyed-out TBPR until you do).

I would have to think about that (chaining rewrites) as basically I haven't a clue at the moment - but essentially it is wrong for one reason or another.  Undecided

To be honest it is going too far, from my point of view, so I wonder if there's an alternative. Actually I'm not sure I understand anyway. What's wrong with a couple of language-specific directories (as long as they aren't in the #1 language of course - you can't have /english/ as a root URL for your whole site, that's out of the question).

Anyway I'll try and find a script...

Logged
dee
Acolyte
*
Posts: 6


« Reply #3 on: April 01, 2008, 11:36:07 AM »

Hi Dee,

Quote
I'll dig out a script.

Im glad to hear there is one... Hnadt been so sure anymore after reading up a little.

Quote
a chain of rewrites is bad news and there comes a point when G says "enough - you can't do that".....it can happen that G rejects 2 rewrites as being over the top....

ok. ive been warned ..
i need to test this though as it may be required by a client.

Quote
it is going too far, from my point of view, so I wonder if there's an alternative. ...... What's wrong with a couple of language-specific directories ?

Personally, I would agree here.
The issue presents itself in part, as being Joomla-specific. Typo, Drupal etc. allow for management of multiple sites/installations from one backend. So, what are we to do when a multilanguage site using SEF, subdomains and a single backend is requested by a client ?

I believe OpenSEF allowed for something like that, tho i never tested it. I've seen tutorials about this while reading up. The point is, with OpenSEF gone (and with the multisite managers availbale for Joomla not being compatible with sh404SEF, for what I can tell)
Its the next logical step to investigate and test.

Quote
Anyway I'll try and find a script...
That would be nice.
Can i conclude, so far, that its technically feasable ?

cheers * thnks
dee
Logged
rolygate
Administrator
Acolyte
*****
Posts: 14


WWW
« Reply #4 on: April 01, 2008, 12:28:48 PM »

Yeah, it's possible. I had a script for that but can't find it now - will look further.

In theory you can rewrite anything in htaccess - from anything to anything. I've seen some really outrageous rewrites; and things like 2,000 lines in an htaccess file for instance.

The only problem might be that you have a rewrite followed by that same thing being rewritten to yet another route. So it may not work, but we'll try anyway. Sometimes you have to arrange the rewrites 'chronologically' in the htaccess file so they are processed in the right order. For instance, first you would do a root URL (like a domain split), then a file redirect, and so on.

Anyway I'm looking for that script, will hopefully find soon (have to look through various hard drives). In any case we can ask for another version if I don't find it.
Logged
rolygate
Administrator
Acolyte
*****
Posts: 14


WWW
« Reply #5 on: April 02, 2008, 01:42:28 AM »

OK, here is what I have found in the vaults, for subdomain to directory (common) and directory to subdomain (rare).

Because you are going to be chaining rewrites (I think), it would be best if you tested out a simple version first. Meaning: create a subdomain and put a page in it, create a directory and put a page in it, then test the redirect from A to B or whatever. After it works OK for a straightforward A to B then you can add in other stuff.

This is for a directory to a subdomain:

Code:
## RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([a-z0-9-]+)/? http://$1.www\.example.com [R=301,NC,L]

Notes:
I commented out the RewriteBase as per usual, but it may be a functional part of this script??
This looks a little too complicated for the job as for some reason it is trying to specify all letters and numbers etc; anyway try it out.


And here is the opposite direction, subdomain >> domain/directory, in case it's of any use. If the directory >> subdomain one doesn't work, I suppose we could try reversing one of these others   Smiley
Code:
RewriteCond %{HTTP_HOST} ^subdomain.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.example.com$
RewriteRule ^(.*)$ http://www.yoursite.com/ [L,R=301]
[redirects subdomain to domain, also fixes www]

RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule ^(.*)$ http://www.example.com/directory/$1
[redirects subdomain.example.com >> example.com/directory/  -- but doesn't fix www]

RewriteCond %{HTTP_HOST} ^sub.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sub.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^example.(.*)
RewriteRule ^(.*)$ http://www.example.com/directory/$1 [R=301,L]
[as above but fixes www]

Try some of that.


Logged
dee
Acolyte
*
Posts: 6


« Reply #6 on: April 03, 2008, 12:22:09 AM »

yo, roly  Smiley

thanks a bunch !
i'll check this out at the next stop and then get back to you with the results ....

regards
dee
Logged
dee
Acolyte
*
Posts: 6


« Reply #7 on: April 03, 2008, 03:02:12 AM »

hi again

the first test wasnt very succesfull
firefox throws a redirection error.

here's what i put in right after the Joomla core SEF stuff.

Code:
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([a-z0-9-]+)/? http://$1.www\.mydomain.com [R=301,NC,L]

the test site runs runs joomla 1.14, joomfish 1.8, and sh404SEF 1.3.2
the site it has 2 languages, and sh404SEF rewrites the second language to a virtual folder that uses the joomfish lang parameters.

in any case, the code is supposed to generally turn *all* folders into subdomains, right ?
i guess that this had to be limited to the language-'folders' only.


hence we have:

domain.com/subject1 <---- in the fist language, english

and

domain.com/spanish/subject1 <- in spanish language

obviously, a script that rewrites any folder to a subdomais, would produce

subject1.domain.com

and

spanish.domain.com/subject1

....which is not what we want.

we'd just want he virtual spanish folder be rewritten to spanish subdomain
(as well as those of other languages we might still wanna add.)


anyways, for now it's refusing to work.
reversing the other code is beyond me...

any hints are highly appreciated...
cheers and thanks
dee

 

Logged
rolygate
Administrator
Acolyte
*****
Posts: 14


WWW
« Reply #8 on: April 04, 2008, 04:43:11 PM »

OK, let's first get the basic htaccess working before applying it to the job you want. Try this, I guess:

1.
Remove any domain / directory redirects in htaccess.

2.
Create a directory like www.a3webtech/test/   [but of course use your domain]
Put a new page in it called /test1.html
On that page have just some text saying: This page is in directory /test/
Check you can visit the page, at www.a3webtech/test/test1.html

3.
Create a subdomain via your cPanel or whatever, call it new.a3webtech.com
Put a new page in it called /test1.html
On that page have just some text saying: This page is in subdomain new.
Check you can visit the page, at www.new.a3webtech/test1.html

4.
Add a directory >> subdomain redirect into htaccess - using the correct directory names.
Make sure it has logical ordering for the commands, so you would have like this:
 1 - fix the www
 2 - subdomain / directory redirects
 3 - CMS-specific redirects

5.
Go to the directory - but now you should see the subdomain page.

6.
And if you like, change the htaccess redirect into the other direction and test that.

Then, once this is working, you can apply it to the job you want to do. There isn't any point trying anything complicated till the basic stage works.

It's like people complaining that sh404 doesn't work or something, but they haven't even got the core SEF working right first   Smiley

Logged
dee
Acolyte
*
Posts: 6


« Reply #9 on: April 05, 2008, 05:37:22 PM »

roger that ...
ill do tha at the next stop and be in touch
thanks for all the help !
dee
Logged
dee
Acolyte
*
Posts: 6


« Reply #10 on: April 14, 2008, 12:17:44 PM »

yo roly

sorry for the delay.
unexpected work came up.

I'm on it tho
I'll create a test installation exclusively for the purpose and report results here.

cheers
dee
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF | SMF © 2006-2008, Simple Machines LLC