Moving domain, 301 redirect proper config Joomla
Moderator: General Support Moderators
-
- Joomla! Apprentice
- Posts: 6
- Joined: Mon Nov 09, 2009 11:21 pm
Moving domain, 301 redirect proper config Joomla
Hello. We recently acquired a new domain for our site and need to formally change it now for SEO reasons. Currently the new domain is active on our hosting account and the old domain is parked. Google results still show up and lead to our old domain. Since the domain is parked no redirect is happening.
I have read that the search engines don't like this and that I need to setup permanent 301 redirects form the old pages to the new ones. I tried to setup redirects in Cpanel but the .htaccess file would not accept the Joomla php pages. There is a wealth of info on this but not specific to Joomla. I just want to make sure that before I submit the formal change to Google I have it setup right.
Does anyone know the proper way to configure this? I am open to removing the domain from it's parked status if it would help. Thanks!
I have read that the search engines don't like this and that I need to setup permanent 301 redirects form the old pages to the new ones. I tried to setup redirects in Cpanel but the .htaccess file would not accept the Joomla php pages. There is a wealth of info on this but not specific to Joomla. I just want to make sure that before I submit the formal change to Google I have it setup right.
Does anyone know the proper way to configure this? I am open to removing the domain from it's parked status if it would help. Thanks!
-
- Joomla! Hero
- Posts: 2268
- Joined: Sat Feb 09, 2008 8:27 am
- Location: California, USA
Re: Moving domain, 301 redirect proper config Joomla
You can use this code (replacing the example.com's with your own domain)
Note that the code above will redirect all requests where the hostname part of the request is not "exactly" http://www.example.com
That takes care of requests for other subdomains and requests for other domains as well as upper case requests and requests with unwanted port numbers. It will also force 'www' into the URL.
The above code was provided by a user named g1smd. More info:
http://forum.joomla.org/viewtopic.php?f ... 9#p2513459
Place the code in your joomla .htaccess file in the correct location:
Place the code directly above ## End - Custom redirects.
Mark
Code: Select all
########## Begin - 301 Redirect
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|home)\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|home)\.html?$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#
########## End - 301 Redirect
That takes care of requests for other subdomains and requests for other domains as well as upper case requests and requests with unwanted port numbers. It will also force 'www' into the URL.
The above code was provided by a user named g1smd. More info:
http://forum.joomla.org/viewtopic.php?f ... 9#p2513459
Place the code in your joomla .htaccess file in the correct location:
Code: Select all
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects
Mark
-
- Joomla! Apprentice
- Posts: 6
- Joined: Mon Nov 09, 2009 11:21 pm
Re: Moving domain, 301 redirect proper config Joomla
Thanks for your help. I tried that but it didn't seem to have any effect. There was no Custom Redirects section so I added it.
A copy of my htaccess is attached. This might be stupid question, but I needed to put my NEW domain to replace exampledomain correct? Also, I have an .htaccess file in both my root and public_html directory. I used the one in the public_html directory as that is where joomla is. I'm guessing that is correct.
Could the problem be related to the fact that the old domain is parked at the webhost in the same Cpanel account??
Thank you!
A copy of my htaccess is attached. This might be stupid question, but I needed to put my NEW domain to replace exampledomain correct? Also, I have an .htaccess file in both my root and public_html directory. I used the one in the public_html directory as that is where joomla is. I'm guessing that is correct.
Could the problem be related to the fact that the old domain is parked at the webhost in the same Cpanel account??
Thank you!
You do not have the required permissions to view the files attached to this post.
-
- Joomla! Hero
- Posts: 2268
- Joined: Sat Feb 09, 2008 8:27 am
- Location: California, USA
Re: Moving domain, 301 redirect proper config Joomla
What version of Joomla are you running?
Starting with Joomla 1.5.23 (I believe) the Custom redirects section was in the htaccess file by default. You should be running Joomla 1.5.25 if on j1.5.
Mark
Starting with Joomla 1.5.23 (I believe) the Custom redirects section was in the htaccess file by default. You should be running Joomla 1.5.25 if on j1.5.
Mark
-
- Joomla! Apprentice
- Posts: 6
- Joined: Mon Nov 09, 2009 11:21 pm
Re: Moving domain, 301 redirect proper config Joomla
It looks like were running 1.5.22. Could that be the problem? I'll upgrade as needed but even after adding the custom redirects manually it still didn't work...any ideas? Did I configure my htaccess file correct based on what you could see?
-
- Joomla! Hero
- Posts: 2268
- Joined: Sat Feb 09, 2008 8:27 am
- Location: California, USA
Re: Moving domain, 301 redirect proper config Joomla
Being on version 1.5.22 would not be the problem however I would advise that you update to version 1.5.25 ASAP. You should also use the htaccess file from the newer version so you'll need to grab the htaccess.txt from the full package.
You could also contact your host and tell them what you are trying to do. If you have cPanel you have the option to point parked domains to other domains I believe. The above code "should" work though. I use it myself on a site that has 5 domains that all go to the same site. Using the code above redirects all the domain names to a single domain name.
Mark
You could also contact your host and tell them what you are trying to do. If you have cPanel you have the option to point parked domains to other domains I believe. The above code "should" work though. I use it myself on a site that has 5 domains that all go to the same site. Using the code above redirects all the domain names to a single domain name.
Mark
-
- Joomla! Apprentice
- Posts: 6
- Joined: Mon Nov 09, 2009 11:21 pm
Re: Moving domain, 301 redirect proper config Joomla
Thank you! I will proceed as you mentioned, first upgrading to 1.5.25.
Last question, in your configuration do you have your domains parked in the same hosting account or simply pointed to the same server?
I'm starting to thing the parking is what is causing the problem. Perhaps the pages are getting found and therefore not picked up by the .htaccess file to forward...just an idea.
Last question, in your configuration do you have your domains parked in the same hosting account or simply pointed to the same server?
I'm starting to thing the parking is what is causing the problem. Perhaps the pages are getting found and therefore not picked up by the .htaccess file to forward...just an idea.
-
- Joomla! Apprentice
- Posts: 6
- Joined: Mon Nov 09, 2009 11:21 pm
Re: Moving domain, 301 redirect proper config Joomla
Update* RESOLVED
Just in case anyone also has this issue, the redirects work fine once Joomla is upgraded to 1.5.25, even with the domain parked.
Thanks again Markstein for your help!
Just in case anyone also has this issue, the redirects work fine once Joomla is upgraded to 1.5.25, even with the domain parked.
Thanks again Markstein for your help!
-
- Joomla! Enthusiast
- Posts: 144
- Joined: Sun Mar 07, 2010 4:01 pm
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
Big thanks for help..i put in wrong place..and then redict just to home page..now working great!!! thanks!
-
- Joomla! Apprentice
- Posts: 21
- Joined: Thu Mar 08, 2012 2:40 pm
- Location: England
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
The code works well even on Joomla 1.5.23 so long as you edit it correctly and change "example.com" with your domain name. This occurs 4 times.
-
- Joomla! Apprentice
- Posts: 21
- Joined: Thu Mar 08, 2012 2:40 pm
- Location: England
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
Hey guys, if you change the custome 301 redirect in your .htaccess file the code on this page provided by gs1md and webdongle is great: http://forum.joomla.org/viewtopic.php?f ... 4#p2761454
- Pete_Evans
- Joomla! Apprentice
- Posts: 32
- Joined: Thu Oct 21, 2010 8:15 am
- Location: Portsmouth, UK
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
Thanks for all the info in this thread. It has helped me out of a big hole I was in replacing a well established .co.uk domain with a newer .com domain and wanting to pass on the ranking juice on a Joomla 1.5 site. I was going around in circles, but upgrading to 1.525 and then adding the redirect code has done the trick!
-
- Joomla! Fledgling
- Posts: 1
- Joined: Tue Jun 05, 2012 6:29 pm
Re: Moving domain, 301 redirect proper config Joomla
Hi guys,
I'd appreciate some help as well. I am very new at this and trying to redirect my old domain but I am not sure how.
I have two active domains in one host package. Currently, they both work as separate domains giving separate links on the website.
How do I make the old domain shift over to the new one?
- In the code provided, which example.com should be the old domain and which should have the new domain?
I'd appreciate some help as well. I am very new at this and trying to redirect my old domain but I am not sure how.
I have two active domains in one host package. Currently, they both work as separate domains giving separate links on the website.
How do I make the old domain shift over to the new one?
- In the code provided, which example.com should be the old domain and which should have the new domain?
-
- Joomla! Hero
- Posts: 2268
- Joined: Sat Feb 09, 2008 8:27 am
- Location: California, USA
Re: Moving domain, 301 redirect proper config Joomla
Just replace example.com (making sure you leave all slashes and periods as they are) in all places in the code with your preferred domain. No need to input both.
Mark
Mark
-
- Joomla! Fledgling
- Posts: 2
- Joined: Thu Oct 04, 2012 7:13 am
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
Code: Select all
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
- pishro
- Joomla! Explorer
- Posts: 301
- Joined: Tue Oct 09, 2012 7:22 am
Re: Moving domain, 301 redirect proper config Joomla
please see this link about: Redirection
Code: Select all
http://moz.com/learn/seo/redirection
- migors
- Joomla! Intern
- Posts: 70
- Joined: Mon Jan 28, 2008 8:56 pm
Re: Moving domain, 301 redirect proper config Joomla
how to replace 303 language redirect from domain.com to domain.com/en to 301?
i really need help, but no answers
i really need help, but no answers
https://seos.lv/pakalpojumi/seo-optimizacija SEO optimizācija
-
- Joomla! Fledgling
- Posts: 2
- Joined: Mon Jun 30, 2014 6:40 pm
Re: Moving domain, 301 redirect proper config Joomla
Hello
I have an old joomla 1.5.24 site and I'm trying to redirect visitors to a new active 2.5 site on the same host. I have applied the above instructions with no result. Could it be that the new site's address is not of the www.example.com type but instead contains several dots and no www?
This is a school website and I am not professional at this, so bear with me and my rather unsophisticated way of describing the situation please :-)
I have an old joomla 1.5.24 site and I'm trying to redirect visitors to a new active 2.5 site on the same host. I have applied the above instructions with no result. Could it be that the new site's address is not of the www.example.com type but instead contains several dots and no www?
This is a school website and I am not professional at this, so bear with me and my rather unsophisticated way of describing the situation please :-)
- dpacadmin
- Joomla! Champion
- Posts: 6029
- Joined: Sat Aug 16, 2008 1:46 pm
- Location: the Bat Cave
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
Make sure you have a
line before your rewrite line or it will not work.
Code: Select all
RewriteEngine On
-
- Joomla! Fledgling
- Posts: 2
- Joined: Mon Jun 30, 2014 6:40 pm
Re: Moving domain, 301 redirect proper config Joomla
thanks for your reply.
I have the RewriteEngine On in the file, but not right above the redirect part of the code. There is other code in between. Does it matter?
I have also turned the Apache mod rewrite on at my site's back end plus I have renamed the htaccess file to .htaccess (dot added).
Thinking about it I'm afraid the problem is that both sites are built on the same root directory so the old one's address is something like (main address)/old site and the new one's like (main address)/new site.
I mean the first part is the same and the changes are after the slash. Perhaps the redirect works but actually redirects the old site to itself
Does this sound possible and if so, what else could I try?
I have the RewriteEngine On in the file, but not right above the redirect part of the code. There is other code in between. Does it matter?
I have also turned the Apache mod rewrite on at my site's back end plus I have renamed the htaccess file to .htaccess (dot added).
Thinking about it I'm afraid the problem is that both sites are built on the same root directory so the old one's address is something like (main address)/old site and the new one's like (main address)/new site.
I mean the first part is the same and the changes are after the slash. Perhaps the redirect works but actually redirects the old site to itself
Does this sound possible and if so, what else could I try?
- dpacadmin
- Joomla! Champion
- Posts: 6029
- Joined: Sat Aug 16, 2008 1:46 pm
- Location: the Bat Cave
- Contact:
Re: Moving domain, 301 redirect proper config Joomla
Try using this redirect generator to make your redirect code. Set the type to Apache htaccess. The redirect code needs to be after the rewrite on code but doesn't need to be right after it.
http://www.rapidtables.com/web/tools/re ... erator.htm
http://www.rapidtables.com/web/tools/re ... erator.htm