Msg#: 4531168 posted 6:38 pm on Dec 26, 2012 (gmt 0)
I recently replaced by Joomla 1.5 site with Joomla 2.5. I moved the old 1.5 site to a subdomain: archive.example.com. I am trying to redirect some of the old urls that appear in the SERPS to their new location in the archive sub-domain (these are urls that no longer exist in the root/new site). In particular the first re-direct I am attempting is:
example.com/blog/ to archive.example.com/blog/
I have been through many WebmasterWorld posts on this (Google search: redirect entire site site:webmasterworld.com) as well as other forums and sites, have tried many examples, i.e. Redirect 301, RedirectMatch 301, and some mod-rewrites with no luck. The best I have been able to achieve is a redirect to the blog front page, archive.example.com/blog.html, when entering a specific blog post: example.com/blog/blogpost01.html.
I have successfully used re-directs in the past and have not had any problems. This seems like it would be a simple one, I must be missing something somewhere but I don't know what. Any advice would be greatly appreciated.
Msg#: 4531168 posted 8:56 pm on Dec 26, 2012 (gmt 0)
these are urls that no longer exist in the root/new site
As long as one person or one robot requests it, the URL exists. Have you physically moved any material, or is it "only" your URL structure that has changed?
You cannot use mod_alias (Redirect by that name) because it looks only at the requested path. You need mod_rewrite with a RewriteCond that looks at the requested domain name (either example.com or subdomain.example.com).
Are you still using (www.)example.com for anything, or do you want to point everything to the subdomain?
If you had no redirects/rewrites in place, where would requests for the subdomain end up? If it lives in a directory that is physically* inside the main-domain directory-- this is the most common setup-- then all requests for the subdirectory will pass through the main domain's htaccess.
* Yes, OK, for a given definition of "physically". Your server is not made out of manila file folders. But we don't usually need to go there.
Msg#: 4531168 posted 10:22 pm on Dec 26, 2012 (gmt 0)
Thanks all. I feel kind of silly now. While looking for a RewriteRule example I ran across a post that mentioned that cPanel has a redirect writing gizmo. Didn't host with anyone that had cPanel until recently and then never paid much attention to it. Anyway this is what it came up with:
Glad it works. I don't put on my 'developer hat' very often and have no idea what most of it means or what it does. I'll have to look for some sort of 'Dummies guide to .htaccess'. Don't really like using wysiwyg widgets but in this case useful.
Msg#: 4531168 posted 12:54 pm on Dec 27, 2012 (gmt 0)
The same errors are in use on tens of millions of websites.