Last active
December 23, 2015 09:28
-
-
Save stevemeisner/6614304 to your computer and use it in GitHub Desktop.
How to efficiently do 301's for Typewriter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO `redirects` (`match`, `redirect_to`, `account_id`, `created_at`, `updated_at`) | |
| VALUES | |
| ('/old_page.php', '/new/page', 40, NOW(), NOW()), | |
| ('/old_page_two.php', '/new/page/two', 40, NOW(), NOW()), | |
| ('/old_page_three.php', '/new/page-two', 40, NOW(), NOW()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Start with going to http://www.xml-sitemaps.com/ and generating the sitemap. | |
| 2. Choose the option to "Download Sitemap in Text Format". It will give you "urllist.txt" with each result on one line. | |
| Open this file with BB Edit and use the following find and replace: | |
| Find: "\r" | |
| Replace with: "', '/new/page', 40, NOW(), NOW()),\r\t('" | |
| Both without the wrapping quote marks, obviously. | |
| You can then replace the the lines in the SQL file above starting with line 3 with your newly formatted 301 list, and once you've filled out the "redirect_to" field for all URLs, you can run it all at once, and be done with it. |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
on Line 6, replace the \r with \n and it will work in sublime