Redirects for new website
-
Hi Moz community,
I'm a fairly new SEO Specialist with a brand new website. We initially had a very basic holding website until the fully functional website was completed. I have to do some redirects as we have both .html and .php files & we don't want to lose SEO value for specific pages (like the index, news, etc). I also want to redirect from a www url to a non-www url.I am trying to accomplish redirects with the following code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mywebsite.com [NC]
RewriteRule (.*) http://mywebsite.com/$1 [R=301,L]RedirectMatch 301 /index.html (.*).(php|html) http://mywebsite.com/index.php
RedirectMatch 301 /cupcakes-slideshow/glutenfree-slideshow.html (.*).(php|html) http://mywebsite.com/gluten-and-glutenfree.php
RedirectMatch 301 /press.html (.*).(php|html) http://mywebsite.com/news-and-reviews.php
Please let me know if I am on the right track. Thanks so much in advance!
-
Thanks so much Jeff. I will try the options you suggested.
-
Yes, there are two main ways to do something like this.
My recommendation would be based on how many actual pages you need to redirect, and if you want to redirect everything, or if you want to redirect only a few pages here and there.
Option 1. Redirect everything using programming.
The first way, is to use a rewrite rule like this:
RewriteRule ^/blog/(.*)$ http://blog.subdomain.com/$1 [R=301,L]... that will redirect things programatically. Your syntax seems to be okay, but I'd test it out to make sure it's working properly.
Advantages: One or two lines, and you're done!
Disadvantages: You are redirecting everything, and you can't test each and every line easily.Option 2. Belt and Suspenders Method.
The second way is what I like to call the belt and suspenders method. It is not elegant. But the theory is that if you wear both suspenders and a belt, chances are good that you won't have your pants fall down.
This option creates a rewrite rule for each page on the site that is added to your .htaccess file.
What's nice about this is that you can easily create these redirects, without programming, just using a sitemap page.
I wrote a long article over on this site:
http://www.advancedwebranking.com/blog/how-to-create-301-redirects-from-sitemap/... that shows how to create these redirects quickly, without any programming (just through Excel and a text editor).
Option 3. Use the rewrite rule, but use the method in option 2 to create a list of all of the pages that need to be redirected.
If you'd rather, you could also use the method for creating a list of all of the pages that need to be redirected, and then use a 301 redirect checking script (there are a lot of free ones out there, just Google it), and then test if your method is working properly.
Hope this helps!
- Jeff
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Redirect Chain Issue
I just found I'm having a redirect chain issue for http://ifixappliancesla.com (301 Moved Permanently). According to Moz, "Your page is redirecting to a page that is redirecting to a page that is redirecting to a page... and so on" These are the pages involved: 301 Moved Permanently
Technical SEO | | VELV
http://ifixappliancesla.com
https://ifixappliancesla.com https://www.ifixappliancesla.com/ This is what Yoast support told me: "The redirect adds the https and then the www, ending at: https://www.ifixappliancesla.com/. You want all variants of your site's domain to end up at: https://www.ifixappliancesla.com/ " - which is totally true. But I would also like not to have the redirect chain issue! Could you please give me an advise on how to properly redirect my pages so I don't have that issue anymore?0 -
Inspection of the website is required.
Hello, Recently We have a taken a project " http://customerconnect-services.com/ " and are responsible for the Digital Marketing for the website. FYI, we have been following the best On-Page SEO practices ever since we took the project: Performing Keyword Research, Finalizing the Keywords,Using those in the Page-Title, Meta-Descriptions, Heading Tags and of course in the Content as per MOZ suggestions & SEO standards. But, we are unable to rank in first page; which is a serious matter of concern for us. We have also checked whether the Domain / URL has been blacklisted, but it's not (Not even by Google). We are therefore unable to figure out what is going wrong even after following so many best practices to get the keywords a good ranking (1st & 2nd page of SERPs). Therefore I would like to request you to provide your expert opinions in this regard by checking what is it that we are not getting right. The website url is http://customerconnect-services.com/. As this is a high-priority issue for us & the client is a prestigious one of course, please help. Looking forward to hearing from you at the earliest. Thanks & Regards,
Technical SEO | | Harini.M
Harini0 -
Keyword rankings for new website good in Yahoo and Bing but no movement in Google?
Hello, This past September I launched a new redesigned website for a client. His old website was a static html site that was many years old and the new website was created using WordPress. With the new design we made sure to use all the proper techniques for SEO. (h1 tages, image names, quality links, page titles, etc.) Plus, all the content is new content written for this site. I've actually launched new sites many times and after a few months usually start seeing keyword ranking improvements from the major search engines. With this particular website I'm seeing improvements in Yahoo and Bing but no movement in Google. I've used Google Webmaster Tools and made sure my sitemap is being submitted, etc. It all seems good, but I can't understand why Yahoo and Bing are working but nothing from Google. My page grades are all A's and B's and Moz isn't showing any big issues. Maybe I need to give it more time? This client is a lawyer and has many websites out there so maybe he's being penalized somewhere I don't know? As I mentioned, I've been doing SEO for about 8 years and have never had this much trouble with Google. I was wondering if you can look at the site and see if there are any glaring issues I'm missing. Website: http://www.arizonamedicalmalpractice.info/ The keyword phrases were are looking at are "Phoenix Medical Malpractice Lawyer", "Phoenix Medical Malpractice Attorney:, "Arizona Medical Malpractice Lawyer & Attorney", etc. I appreciate anyone who takes the time and does a quick look over. Thanks very much, Bill
Technical SEO | | Bill_K0 -
41.000 pages indexed two years after it was redirected to a new domain
Hi!Two years ago, we changed the domain elmundodportivo.es to mundodeportivo.com. Apparently, everything was OK, but more than two years later, there are still 41.000 pages indexed in Google (https://www.google.com/search?q=site%3Aelmundodeportivo.es) even though all the domains have been redirected with a 301 redirect. I detected some problems with redirections that were 303 instead of 301, but we fixed that one month ago.A secondary problem is that the pagerank for elmundodportivo.es is 7 yet and mundodeportivo.com is 3.What I'm doing wrong?Thank you all,Oriol
Technical SEO | | MundoDeportivo0 -
302 to 301 redirect
Our site has quite a few 302 redirects that really ought to be 301's. Our IT department is really busy so the question is, given that the 302's have probably been in place for years, is it worth changing them to 301's now? Thanks
Technical SEO | | Houses0 -
Redirecting Parked Domain
I just recently switched hosting. We have 3 domains and 1 being the main domain. Right now they are set up as parked domains. Can I redirect the parked domains under my main websites .htaccess file ? I am just worried that good we will get hit for duplicate content, even though technically the content is only on our main domain. right now if I type in my parked domains in Google, they appear in search. The site is all hand coded and not using a CMS.
Technical SEO | | hfranz0 -
Redirect or not to redirect
We are rebuilding a website and try to get rid of errors. The content remains exactly the same but we correct the code and make it load faster. The site has quite many backlinks and I can't decide whether to remove .html endings from the urls and 301 redirect to the new ones or leave them with the older ending. If I remove the endings how much of the link juice will be passed? Anyone any idea?
Technical SEO | | sesertin0 -
Redirecting an Old Domain
One of my clients has a newish e-commerce website that was just redesigned. Part of this new marketing push is shutting down an old yahoo store. The problem is that this old store's domain has a 10 year old link in DMoz and is there fore in about 200 other directories. Is pointing that old domain at the new website going to be enough to keep all of that link juice flowing?
Technical SEO | | Simple_Machines0