We're moving a fairly large website from domain.one where it's been for a long time onto domain.two. If people still find links for domain.one we want them to redirect to an appropriate place on domain.two (if possible).
Domian.one is no longer required after the switch. I don't know anything about moving an entire domain so could use some advice on the best way to go about switching whilst retaining the SEO gained over the years.
Any help is appreciated.
Many thanks
Put this in an htaccess file in your root web directory. It will forward your users, and search engines, to the new URL on the new domain.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
ADD THE FOLLOWING LINES as posted by John .
Also log in to google webmaster tools->configuration->change of address
and change your url ther so that seacrh engine results are also changed.
THIS iS VERY IMPORTANT
Related
Some time ago (I think a couple of years) this simple RewriteRule in my htaccess stopped working.
RewriteRule tags/ tags.php [L]
It worked for years, then a day after a server change or a server upgrade or switch to php-fpm (I don't remember) it stopped working.
I solved it by deleting it, and sending all my links directly to the tags.php file.
This rule is part of a small CMS that I use for many of my sites. The sites work and everything works correctly.
But punctually when I create a new site, after a few days google sends me a warning telling me that the url mysite.com/tags/ creates an error 404.
And this is strange, because the url mysite.com/tags/ no longer exists for years now in my sites, nor in my sitemaps, I am sure because it is used only once in the main menu of my sites, and has been replaced with mysite.com/tags.php.
Above all it cannot exist in new sites. At first I didn't pay much attention to it on old sites. Probably google may have seen it in the old sites, and haven't forgotten it yet, but surely can't have seen it in the new sites.
So, I have a couple of unanswered questions.
The first and perhaps most important to understand: How does google see the url mysite.com/tags/? Is it possible that google reads my htaccess to understand what kind of url I'm going to create?
Second: how can I solve the problem permanently?
--------------------------update---------------------
Sorry for the delay with which I reply (summer vacation).
Regarding anubhava's answer, I have a doubt, but it's my fault, maybe I omitted part of the code.
The next rule says:
RewriteRule ^tags-([^/]+)\/$ tags.php?letter=$1 [L]
and makes work some urls like:
mysite.com/tags-k/
and these urls work, but if I put a 301 redirect on tags.php, will they still work?
No, Google (or any other) search bot cannot read your .htaccess
It is difficult to figure out how search bot found /tags URI but it is definitely hidden somewhere in your web pages.
Now to tell search bots that /tags doesn't exist is to use a redirect rule with R=301:
RewriteEngine On
RewriteRule ^tags(/.*)?$ /tags.php [L,NC,R=301]
With this 301 rule search bot will eventually let go old /tags/ result and will remember /tags.php only.
I had to redesign a site last week. The problem is that last urls weren't seo friendly so, in order to avoid Google penalizing my site because too many 404 errors, I have to create a lot of Rewrite Rules because all the content had awful URL's ( and that content had a good position on SERP's).
For example:
RewriteRule ^documents/documents_for_subject/22-ecuaciones-exponenciales-y-logaritmicas http://%{HTTP_HOST}/1o-bachillerato/matematicas-cc.ss/aritmetica-y-algebra/ecuaciones-exponenciales-y-logaritmicas [R=301,L]
Is this a problem on my performance? Is there another solution to my situation?
Thanks
They are in the same domain.
Then an internal redirect is much better. A header redirect sends the new URL to the browser and causes it to make a new request; an internal one is handled, as the name says, internally.
This should work:
RewriteRule ^documents/documents_for_subject/22-ecuaciones-exponenciales-y-logaritmicas /1o-bachillerato/matematicas-cc.ss/aritmetica-y-algebra/ecuaciones-exponenciales-y-logaritmicas [L]
Any performance issues are going to be negligible with this - except maybe if you have many thousands or tens of thousands of individual rules, those may slow down Apache. In that case, if you have access to the central server configuration, put the rules there instead of a .htaccess file, because instructions in the server config get stored in memory and are faster.
A. Yes using 301 is the right way to notify search bots about changed URLs and eventually your old URL's will be removed from search results.
B. You don't need to use %{HTTP_HOST} in your rewrite rule just use it like this:
RewriteRule ^documents/documents_for_subject/22-ecuaciones-exponenciales-y-logaritmicas http://%{HTTP_HOST}/1o-bachillerato/matematicas-cc.ss/aritmetica-y-algebra/ecuaciones-exponenciales-y-logaritmicas [R=301,L]
C. If you have lots of RewriteRules like above I recommend using RewriteMap or else use some scripting support (like PHP) to redirect from old to new URL with 301.
I have an e-commerce developed with the CMS Prestashop.
Yesterday i have seen in my Webmaster Tools that i had some duplicated URL, like this:
www.mysite.com/manufacturers
www.mysite.com/it/manufacturers.
Where 'it' is the suffix of the default and only language for the website.
I've already activate the friendly URL in the back-office and also I've a .htaccess file generated automatically by the generator in the back-office.
What should I do to fix this issue?
PS: Also I think that I've already taken a penalization from googlebot.
First of all let me clarify the Title from the SEO point of view. The problem is from Prestashop side not from SEO side. It is just affecting your SEO.
Now on the problem, Prestashop is notorious for URL problems. I would not recommend you the .htaccess hack solution because every time you regenerate your .htaccess from you backend, you have to manually insert that hack again in it to keep the problem down. And suppose this url problem arises again after sometime for some other url than you have to do it again. It can turn into a nightmare.
So here are some of my personal recommendations...
If this site is critical(which I am assuming), buy a Prestashop url rewriting module from a trusted provider. You will also get a technical support in case this problem arises again in future.
If you can't buy than I would suggest you to ask this question on Prestashop forums, as this is Prestashop specific, to permanently solve this problem. You will most likely to get more instant answers as you will find more people working on Prestashop there than here.
Somewhere either in the htaccess file in your document root, or in the vhost/server config for mysite.com, you'll need to 301 redirect. Now you just need to choose which one you want to keep, the one with /it/ in front or the one without? Let's say you want to point everything to the one without, you'll use one of these:
Using mod_alias:
Redirect 301 /it/manufacturers /manufacturers
Using mod_rewrite:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mysite.com$ [NC]
RewriteRule ^/?it/manufacturers(.*)$ /manufacturers$1 [L,R=301]
I have an paginated list of articles and my search engine is indexing the first page twice as /articles and /articles?start=1.
I want to write an .htaccess rewrite rule to rewrite any requests for /articles?start=1 to /articles to stop this from happening.
There are a couple of other article based paginated lists on the site, so i need to match just the parameter rather that the full url, so that the rule will work on thse urls also.
Thanks for your help!
Try this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} \/articles\/
RewriteCond %{QUERY_STRING} start=1
RewriteRule (.*)$ /index.php\?
I am assuming articles is a directory.
A bit of a necro, but I just found this question via Google when looking for something else.
Recently, Google offered up way more control over how URL parameters affect their indexing of your site. Go to Google Webmaster Tools and set up your site.
Google will crawl your site and add a list of URL parameters its aware of (and I beleive you can add your own to the list). You can specify how the URL parameters affect your page (pagination, filtering, internal etc) which in turn tells Google how to index it.
In this case, you'll be able to say that start should be either ignored, indexed only once, or treated how you see fit to make sure it only appears how its meant to in the index.
This helps Google and also helps you, so its entirely win-win.
First, I have already spent the past few hours trying to find a solution for this, but have had nothing but non-working solutions :(
It's pretty simple - I'm pointing the DNS of a new domain to my current hosting, but when I visit the new domain, I'm just viewing my original site (the one i got with my hosting).
Let's say my original site is "www.originalsite.com" - the content for my new domain is at "www.originalsite.com/newsite.com/" (dots included).
Now I just need to get "www.newsite.com" to re-direct to it's own directory AND re-write itself to hide the directory name.
So yeah, "www.newsite.com" needs to use the content in "www.originalsite.com/newsite.com/", but remain displayed as "www.newsite.com" in the URL bar.
Cheers for any input - really appreciated :)
PS: I'm using ColdFusion and previously made a useful re-direction, but the result was typically "www.netsite.com/newsite.com/" - which is not what I want :)
Oh...and yeah, I'm hoping for an .htaccess fix :) thanks!
If you have full control over the server, a VirtualHost in httpd.conf is probably a better solution. For example:
<VirtualHost newdomain.com:80>
ServerName newdomain.com
ServerAlias www.newdomain.com
DocumentRoot /path/to/webroot/newsite.com
</VirtualHost>
If you don't have the ability to do this directly, any good host will provide a "Park Domain" function which allows you to achieve the same effect - specifying your new domain and identifying which directory you want it to point to - via the web control panel.
However, if you don't have the ability to do that, here's a mod_rewrite for .htaccess that should work:
RewriteEngine On
RewriteCond %{REMOTE_HOST} (www\.)?newdomain\.com
RewriteRule ^(.*)$ /newdomain.com/$1 [L]
CrystalTech have just recentely installed a mod that provides htaccess ...
Though they've only done it one server so far :) so I'm being moved onto that server.
Problem solved I guess - heh!
PS thanks for the help anyway guys :)
You could do the redirect with a "cloaked" frame page.
That way the URL in the browser's address bar stays the same (no extra path), and it remains simple to use the subdirectory.
The following link describes this for classic ASP - but it should be simple to convert to any server side scripting language/platform:
http://www.simpledns.com/kb.aspx?kbid=1151