Background: I've got a web app on sub.domain.com. My primary website is on domain.com. My sub.domain.com pages are stuffed with keywords that I would like to use to get upped in pagerank on domain.com. however, the whole app has been written on sub.domain.com, and it'll be some effort to host it at domain.com/subdirectory, due to how URLs are written, etc.
First question: would you expect that migration (from sub.domain.com to domain.com/subdirectory) to substantially improve the pagerank of domain.com over how it is now? I've done a lot of research, and opinions are split on if google with link the subdomain with the main domain.
Next question: if I do want to do the migration, it'll be difficult to do in the actual codebase (more tedious than difficult). Does anybody have some advice for how I could do this with mod_rewrite? I know there has to be a clever way to do it, but I can't even start to sketch out a solution. Maybe this means it's not a good thing to do, but I was hoping for kind of a quick hack, rather than rewriting all my URLs. Plus, I would like it to be pretty easily reversible, which wouldn't be the case if I change my URLs (dev is ongoing, so it's not as simple as just rolling out a previous version).
.htaccess passing domain name
Mod-Rewrite for large sites…how much is too much?
- Pagerank isn't a property of domains, it's a property of individual documents.
Mod Rewrite with Joomla
So it'd be more accurate to say that migration from
domain.com/subdirectorywill improve the pagerank of
htaccess redirect problem
If you're concerned solely about the ranking of the
domain.comhome page, the impact on that will mostly depend on your internal linking.
301 Htaccess Redirect Rule
For example, if all pages on
sub.domain.comcurrently have a "home" navigation link that leads to the home page of
sub.domain.com, and when you do your move they'll now lead to the home page of
domain.com, then this will contribute to the
domain.comhome page's ranking.
301 Redirect Rule
If this "home" navigation link went to
domain.com/subdirectory, on the other hand, then that's what they'll be contributing pagerank to..
mod rewrite everything but one request_uri
- mod_rewrite doesn't change the outbound links in your HTML, it changes how inbound links are interpreted.
So it would let you put this in the virtual host file or
RedirectRule (.*) http://domain.com/subdirectory/$1 [R=301]
to mass redirect any requests coming in on
sub.domain.comwhere they need to go.
It won't help you produce correct new-form URLs in your codebase.
(You could, in theory, leave all your links how they are and rely on the 301 redirect to keep you from having to change them, but this is really sloppy and wasteful, generating two HTTP requests instead of one for no good reason)..