301 redirect to new website
-
We are migrating to a new website that will be using entirely new URLs under the same domain as the old website. The old website is a custom PHP script and the new website uses Drupal.
I know that I should use individual 301 redirects to the corresponding new pages.
My question is just how to set up the hundreds of 301 redirects from the old website to the new one?
Here is the process I've come up with. Please let me know if there is an easier and better way for this.
- Before actually changing to the new website: download an advanced report with all pages on this domain from OSE.
- Find corresponding pages on the new website
- Make the hundreds of 301 redirect lines in an .htaccess file with the following code:
redirect 301 /oldurl.html http://domain.com/the-full-url
Thanks in advance for your help!
-
My preference would always be to use the htaccess file for redirects. There are some situations where the site owner cannot modify their htaccess file due to various restrictions, in which case you would need to use a CMS-based solution or extension.
-
Excellent point, Rebekah. Just how would you do the redirects? In addition to finding out which pages to redirect, I'm particularly interested in the best/fastest technical way to achieve these redirects.
Is it right to do this within the .htaccess file, even if it can become quite large with a few hundred lines of redirects?
-
Thanks for your valuable input, Ryan.
Would you do the redirects with .htaccess file, or would you use another way like a Drupal module. If you would use a module, can you recommend one?
-
I agree Rebekah. Sometimes there are factors outside our control which hinder the optimal SEO solution. In those cases, you can ensure the client is aware of the impact and adjust as you recommended.
-
I agree - in a perfect world redirect all pages. I should have worded my answer more clearly to say "While 301 is a good solution, I don't always recommend it if it is not feasible due to the amount of pages on your site..."
I've worked with a lot of companies who have a lot of red-tape to go through, and really stubborn developers who often refuse to do a lot of "SEO beneficial" work they feel is unnecessary. It's really surprising how much control is in the dev's hands for changes, even coming from upper management, but this is generally a great middle ground for those types of situations.
Thanks for adding that Ryan
-
I agree with most of your plan.
I am not clear if by "advanced report" you are referring to an Open Site Explorer advanced report. If so, I would not recommend that approach. Instead, use a crawler to update your sitemap, then use the sitemap as the most complete list of URLs.
Also, I differ with Rebekah on the point of only redirecting the URLs with the most traffic. When possible I would recommend redirecting every URL to the appropriate page on your new site. Many people might bookmark a page, send an e-mail with a link, etc. You never know who has saved a URL to a page on your site. Also, you did not mention your market. Sometimes a single client is worth thousands of dollars. I would hate to risk losing a potential sale by saving the relatively small amount of time it takes to perform a redirect.
However you choose to proceed there are two additional suggestions. First, ensure your 404 page is friendly and helpful. It should offer your site's navigation, a search box, etc. Second, review your 404 errors DAILY after the site move until your error count drops down to very low numbers.
Good luck.
-
301 redirecting is a good solution, but I don't always recommend redirecting every page. Does every page get a lot of incoming search traffic on its own? I would look at your analytics by landing page and take a look at your top landing pages, and then run an OSE report and see what your top pages there are by amount of links. I would concentrate on redirecting those because they are the most important. You can then do a mod-rewrite to something like a corresponding category for the other pages to make it easier.
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
-
Where to put 301 redirects in my Wordpress htaccess file?
I have about 25 301 redirects in my Wordpress htaccess file, that look like this: <code>Redirect301/store/index.html https://www.notesinspanish.com/store-home/</code> At the moment they are at the bottom of my htaccess file, below the usual Wordpress rewrite rules: <code># BEGIN WordPress <ifmodulemod_rewrite.c>RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress</ifmodulemod_rewrite.c></code> So they are below all that. Above my WP rewrite rules I have a number of other rules from plugins (caching, ssl). Are my 301's OK where they are at the very bottom of that file? They are working, and redircting pages correctly. Should they be somewhere else? Many thanks for any help. Thanks for any help.
Technical SEO | | Benspain0 -
Migrating website to new CMS and to https://
Hi, We are migrating an old website to a new one built in Wordpress soon. We also added an SSL to change to https:// Most of the url's stay the same. Can we just migrate from http to https on server level, and for the url's that do change just set a 301 redirect? Or are there other things we should take into account?
Technical SEO | | Mat_C0 -
Selective 301 redirections of pages within folders
Redirection Puzzle - it's got me puzzled anyhow! The finished website has just been converted from an old aspx affair to a wordpress site. Some directory structures have changed significantly; there appears to be a load of older medical articles that have not been added back in and it sounds unlikely that they will be. Therefore unmatched old news articles need to be pointed to the top news page to keep hold of any link value they may have accrued. The htaccess file starts with ithemes security's code, Followed by the main wordpress block and I have added the user redirects to the final section of the htaccess file . I have been through the redirects and rewrites line by line to verify them and the following sections are giving me problems. This is probably just my aging brain failing to grasp basic logic. If I can tap into anybody's wisdom for a bit of help I would appreciate it. My eyes and brain are gone to jelly. I have used htaccesscheck.com to check out the underlying syntax and ironed out the basic errors that I had previously missed. The bulk of the redirects are working correctly. #Here there are some very long media URLs which are absent on the new site and I am simply redirecting visiting spiders to the page that will hold media in future. Media items refuse to redirect
Technical SEO | | TomVolpe
Line 408 redirect 301 /Professionals/Biomedicalforum/Recordedfora/Rich%20Media%20http:/kplayer.kcl.ac.uk/ess/echo/presentation/15885525-ff02-4ab2-b0b9-9ba9d97ca266 http://www.SITENAME.ac.uk/biomedical-forum/recorded-fora/ Line 409 redirect 301 /Professionals/Biomedicalforum/Recordedfora/Quicktime%20http:/kplayer.kcl.ac.uk/ess/echo/presentation/15885525-ff02-4ab2-b0b9-9ba9d97ca266/media.m4v http://www.SITENAME.ac.uk/biomedical-forum/recorded-fora/ Line 410 redirect 301 /Professionals/Biomedicalforum/Recordedfora/Mp3%20http:/kplayer.kcl.ac.uk/ess/echo/presentation/15885525-ff02-4ab2-b0b9-9ba9d97ca266/media.mp3 http://www.SITENAME.ac.uk/biomedical-forum/recorded-fora/ #Old site pagination URLs redirected to new "news" top level page - Here I am simply pointing all the pagination URLs for the news section, that were indexed, to the main news page. These work but append the pagination code on to the new visible URL. Have I got the syntax correct in this version of the lines to suppress the appended garbage? RewriteRule ^/LatestNews.aspx(?:.*) http://www.SITENAME.ac.uk/news-events/latest-news/? [R=301,L] #On the old site many news directories (blog effectively) contained articles that are unmatched on the new site, have been redirected to new top level news (blog) page: In this section I became confused about whether to use Redirect Match or RewriteRule to point the articles in each year directory back to the top level news page. When I have added a redirectmatch command - it has been disabling the whole site! Despite my syntax check telling me it is syntactically correct. Currently I'm getting a 404 for any of the old URLs in these year by year directories, instead of a successful redirect. I suspect Regex lingo is not clicking for me 😉 My logic here was rewrite any aspx file in the directory to the latest news page at the top. This is my latest attempt to rectify the fault. Am I nearer with my syntax or my logic? The actual URLs and paths have been substituted, but the structure is the same). So what I believe I have set up is: in an earlier section; News posts that have been recreated in the new site are redirected 1 - 1 and they are working successfully. If a matching URL is not found, when the parsing of the file reaches the line for the 1934 directory it should read any remaining .aspx URL request and rewrite it to the latest news page as a 301 and stop processing this block of commands. The subsequent commands in this block repeat the process for the other year groups of posts. Clearly I am failing to comprehend something and illumination would be gratefully received. RewriteRule ^/Blab/Blabbitall/1934/(.*).aspx http://www.SITENAME.ac.uk/news-events/latest-news/ [R=301,L] #------Old site 1933 unmatched articles redirected to new news top level page RewriteRule ^/Blab/Blabbitall/1933/(.*).aspx http://www.SITENAME.ac.uk/news-events/latest-news/ [R=301,L] #------Old site 1932 unmatched articles redirected to new news top level page RewriteRule ^/Blab/Blabbitall/1932/(.*)/.aspx http://www.SITENAME.ac.uk/news-events/latest-news/ [R=301,L] #------Old site 1931 unmatched articles redirected to new news top level page RewriteRule ^/Blab/Blabbitall/1931/(.*)/.aspx http://www.SITENAME.ac.uk/news-events/latest-news/ [R=301,L] #------Old site 1930 unmatched articles redirected to new news top level page RewriteRule ^/Blab/Blabbitall/1930/(.*)/.aspx http://www.SITENAME.ac.uk/news-events/latest-news/ [R=301,L] Many thanks if anyone can help me understand the logic at work here.0 -
New website on new url?
We have a new website on a new url (been up for around 2 years now) and our old website is slowly fading in the background, we are now at the point where the money is still ok but we are having issues running both side by side, we have a calculator on each page and are thinking about removing this and adding a box with please order from our new site here (with url of similar page). Now the issue is we don't want to link for SEO purposes and google hammer us (thinking of no - following these) and we also have a penalty we got in 2012 on the site but we did get out of this, would this cause any issue to the new site?
Technical SEO | | BobAnderson1 -
Sudden drop in Rankings after 301 redirect
Greetings to Moz Community. Couple of months back, I have redirected my old blog to a new URL with 301 redirect because of spammy links pointed to my old blog. I have transfer all the posts manually, changed the permalink structure and 301 redirected every individual URL. All the ranking were boosted within couple of weeks and regained the traffic. After a month I have observed, the links pointed to old site are showing up in Webmaster Tools for the new domain. I was shocked (no previous experience) and again Disavowed all links. Today, all the positions went down for new domain. My questions are: 1. Did the Disavow tool worked this time with new domain? All the links pointed to old domain were devaluated? Is this the reason for ranking drop? Or 2. 301 Old domain with Unnatural links causes the issue? 3. Removing 301 will help to regain few keyword positions? I'm taking this as a case study. Already removed the 301 redirect. Looking for solid discussion.Thanks.
Technical SEO | | praveen4390 -
260k 301 redirects
Hello, I just found that some of the urls on my site have both ugly characters and some other things I'd like to fix (such as ---- into a single - ) After some local tests i've seen that If i leave some imperfections there will be 48k different urls on the other hand if the renaming procedure is strict i'll have around 260k out of 2.3M urls to be renamed. If I'm going to do this I'll create new canonicals meta tag and redirect old urls with 301 headers to the new location. The content will not change. My big doubt is SEO wise, I know that I'll have better urls, but aren't those too much redirects on a single day? what would you do if you wish to have shipshape urls and know some of these are crap? thanks
Technical SEO | | mylittlepwny0 -
Another 301 redirect question - penalty?
Good Morning, We have 2 sites have images and minimal text on them. The images have links that point to a 3<sup>rd</sup> site that facilitates eCommerce. Question: If we 301 redirect these sites permanently to yet a 4<sup>th</sup> site… 1) Does it violate any G’s guidelines 2) Should we delete the links embedded in the images (as they point to the 3<sup>rd</sup> site) Thanks
Technical SEO | | Prime850 -
A script to automatically write 301 redirect rules to htaccess?
I was wondering if anyone could help provide some resources on how to automatically write 301 redirect rules to htaccess. Allow me to explain... I'm building a new website and the primary users are businesses. They have their own profile pages on the site. The URL is based off of their Company Name. In the event that they decided to change their name... reasons being, perhaps they mispelled it the first time, or they're removing LLC or adding Inc, I want to also change the URL and redirect the old URL to the new URL. Since the URL is based off of their Company Name, making a change to the company name would make a change to the URL. I know it doesn't have to work this way, but for our purpose this works best. In case the old URL had any links to it, I wanted to see if there was an way to automatically update an htaccess file with a 301 redirect from the old URL to the new one. Could anyone point me in the right direction of how to do this? Perhaps a sample script. I've done a lot of searches on Google and can't seem to find anything. e.g. Original:
Technical SEO | | bimmer540
Name: XYZ Widgets
URL: website.com/xyz-widgets New - business changes their company name in their profile:
Name: XYZ Widgets, Inc.
URL: website.com/xyz-widgets-inc Upon the user saving the changes in their profile, I'd like to write a 301 redirect to an htaccess file:
Redirect 301 /xyz-widgets http://www.website.com/xyz-widgets-inc I know how to manually write redirects and I've got a pretty smart web developer. We've just never triggered a script to automatically write to an htaccess file before. Is this possible? Any resources are appreciated. Any security risks? Thanks!0