Migrating your WordPress site to a new host, or setting up redirects, are common practices for those who run into problems with their hosting provider or site structure. They’re just two of many scenarios in which you would need to export WordPress URLs.
Fortunately, there are a number of free plugins and tools to help you get the job done. In this post, we’ll explain why you’d need to export your WordPress URLs, then show you how to do it using two different methods. By the time we’re done, you’ll be able to export WordPress URLs with aplomb!
What WordPress URLs Are and Why You Would Need to Export Them
For the uninitiated, WordPress URLs (also called ‘permalinks’) are the unique links to your content, and setting them up correctly has a number of Search Engine Optimization (SEO) benefits. What’s more, WordPress is more than just a powerful Content Management System (CMS). It also comes bundled with a handy toolkit of its own that enables you to undertake maintenance-related tasks without having to get into a single line of code – including exporting your WordPress URLs.
So, why would you need to export your site’s URLs? There are a number of scenarios where you’ll find you’ll need a complete list. For example:
- Migrating your WordPress site: If you’d like to migrate your WordPress website without affecting your SEO, you’ll have to update the URLs ahead of time.
- Moving your site from a localhost installation to a live installation: When it’s time to launch your site, you may need to modify your URLs to reflect your live domain.
- Setting up redirects: If you’d like the traffic from one page to be sent to another, you’ll need to redirect your WordPress URLs to the new link.
- Sharing URLs with your SEO team: It’s a common practice, and you may need to update your URL structure as a result. It’s a similar case with setting up tracking with SEO tools.
With that brief overview out of the way, let’s dive right into the tutorial! We’ll start out by walking you through the process of exporting WordPress URLs using a plugin (the easy way), then show you how you can do the same manually (the hard way).
How to Export WordPress URLs Using a Plugin
It’s always a good idea to make a backup of your website before tinkering with your site’s core files (that’s easy using a WordPress backup plugin). That way, if the worst happens, you can almost instantly roll back to a clean, working version of your site.
Once you’re fully backed up, you’ll want to install a suitable plugin – we’re using Export All URLs. This plugin offers a quick and easy solution to extract the URLs, titles, and categories of your posts and pages. For our purposes, we’re only interested in exporting WordPress URLs.
Exporting to CSV
The Comma Separated Values (CSV) format is generally used to store tabular information. This data is usually exported to a spreadsheet file (such as Microsoft Excel) with one record per line.
CSV files should be used when you already understand the structure of your data. In this case, we know that we’re only exporting WordPress URLs, which makes exporting to CSV a good choice. Here are some additional benefits:
- CSV is readable by humans.
- The format is easy to edit and modify manually.
- Almost all existing applications support the CSV file format.
How to Export Your URLs in CSV Format
Firstly, log in to your WordPress site’s admin panel, then navigate to Settings > Export All URLs. At the next screen, select the following options:
- Select a Post Type to Extract Data: All Types (pages, posts, and custom post types).
- Additional Data: URLs.
- Export Type: CSV.
Finally, click the Export button to export the URLs in CSV format:
Once exported, a notification will be displayed with a link to download the data. Once you download the file, it’ll display a list of your site’s URLs.
Exporting to Plain Text
Plain text is simply a format that doesn’t have any tags or special formatting in place – it’s data that isn’t written in code under the hood.
The obvious benefit of exporting to plain text is that it’s incredibly easy to read by humans, especially when offered in an HTML or XML file. Aside from this, there are a few other reasons you may want to export to plain text:
- Plain text doesn’t require specific software to edit its contents.
- It’s robust in the face of data corruption.
- It enables different programs to access each other’s files.
How to Export Your URLs in Plain Text Format
Similarly to exporting to CSV, log into your WordPress site’s admin panel, then navigate to Settings > Export All URLs. At the next screen, select the following options:
- Select a Post Type to Extract Data: All Types (pages, posts, and custom post types).
- Additional Data: URLs.
- Export Type: Output here.
Finally, click the Export button to export the URLs:
Once exported, the URLs will be displayed below your settings, where you can copy and paste them into your favorite text editor.
How to Export WordPress URLs Manually
Although using a plugin produces good results, you may want to export your URLs manually – at the very least, you’re saving potentially valuable resources. For this method, you’ll need access to a File Transfer Protocol (FTP) client – we recommend the open-source FileZilla – or use the File Manager in cPanel. If you’re new to FTP, find a good tutorial, and brush up on your skills before starting – and don’t forget to create a backup of your WordPress website before you begin!
To get started, create a new file on your computer, and enter the following code (based on a Bloggersignal snippet) encased within PHP tags:
include "wp-load.php"; $posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish'); $posts = $posts->posts; header('Content-type:text/plain'); foreach($posts as $post) { switch ($post->post_type) { case 'revision': case 'nav_menu_item': break; case 'page': $permalink = get_page_link($post->ID); break; case 'post': $permalink = get_permalink($post->ID); break; case 'attachment': $permalink = get_attachment_link($post->ID); break; default: $permalink = get_post_permalink($post->ID); break; } echo "\n{$permalink}"; }
Next, save the file as a .php file and name it exported-urls.php. Once saved, log into your FTP client using the credentials provided by your host, navigate to your root directory (normally called www or public_html), then upload the exported-urls.php file.
Once complete, navigate to http://www.yoursite.com/exported-urls.php in your browser, where you’ll see a list of your exported URLs. From there, you can copy the links as normal.
Conclusion
Exporting your WordPress URLs is a common task, especially for migrating your site or setting up redirects – but for some it could be difficult. There’s a method available for any level of technical expertise, and in this post, we’ve walked you through two different ways to achieve it:
- With a plugin: The Export All URLs plugin is probably the best option for the majority of WordPress users.
- Manually: Exporting URLs manually with an FTP client or the File Manager in cPanel is ideal for those who are comfortable with code.
After reading this piece, you should now be in a good position to export your own WordPress URLs.
Do you have any questions about how to export your WordPress URLs? Subscribe to the conversation, and let us know in the comments section below!
Article thumbnail image by harper kt / shutterstock.com.
This worked perfectly with php method. The plugin gave me errors. Is there a modification I could make to php that would also echo a column to identify if it is a post or a page?
Thanks for the info. Always love coming to the blog ?
It can help other people who wants to know how to Export WordPress! KEEP UP the GOOD work! 🙂
Thank you! It gave me knowledge. Hoping to see your next post!
It gave me knowledge! Wishing to see one of your posts again!
It was a nice knowing this Export URLS!
Thanks for the kind words, Nico!
I was succesful on “Export All URLs” plugin method. Thank you very much for sharing that.
No problem, Rayhan!
You can also use screaming frog
Thanks for the tip, Bulut. 🙂
Thanks ?
No problem, Ylem. 🙂
Great article. I have a question…I am using http for now at my web page. Should I condiser moving to https or is it to sson?
Switching to HTTPS is never too soon. Do some research, though – you could introduce further problems if you’re not careful.
Thanks for your question. 🙂
The plugin allows you to export URLs, title, categories. There is also an option to either export this data in a CSV file or display it right on the settings page.
Steve
Nice. Didn’t know it would be this easy to aggregate all urls and export 🙂
Well, now you do James. 🙂
Hi everyone
How can I insert urls, from HTML web pages into WordPress. Or from other web systems. Or rather, no Wordoress convert websites into a WordPress page.
I’m missing something (big): now that one knows how to export the URL’s can you please tell us how to actually USE the exported URL’s in support of each of the scenarios you mention?
That, Jon, is a subject for another article! It was slightly outside of the remit for this one, but we’ll look to write up something about importing another time.
Thanks for your comment. 🙂
Sorry I’m with Jon here – what next? For every export there is a corresponding import?
Yes, I also would like to know how to USE the exported URLs in the four scenarios mentioned.
Yes, I also don’t understand what you need the list of URLs for, or how to use them. Thanks.
Thank you 🙂
You have done a very nice expression, probably worth a try 🙂
You can also use screaming frog 🙂
Thanks for the suggestion, John-Pierre. 🙂
Migrating a website from one platform to another is a little tough job and when we migrate our blog/website from wordpress to other CMS we had to export our WP URLs. Here you have described the full method very easily and effectively which will help newbie bloggers to migrate their blogs. Really great guide. Thanks for sharing the information added beautiful guide here.
Hi Jhon,
I have a site created with Divi, but expired the domain name that I used for this site.
Then, I bought a new domain name,
I want to know:
How to can I use the files the this site with the new domain name?
do you have any recomendations for me?
thanks in advance!
Guillermo, you’ll want our article on Duplicator. You can use it to migrate your website (https://www.elegantthemes.com/blog/tips-tricks/duplicator-an-easy-way-to-back-up-copy-or-clone-your-wordpress-content).
Hope this helps. 🙂
If you have ssh access to your site install wp-cli from https://wp-cli.org/
and do:
wp search-replace ‘http://old-domain.com’ ‘http://new-domain.com’
Guillermo,
I have a similar situation. Would love to know what you end up doing…
LOVE this php file! Great for redirect logs. Thanks.
I get urls from sitemap.xml 😉
Thanks for the additional tip, Javier. 🙂