I need to view all the URL rewrites & redirects in place. Is there a way in the Admin Console to dump these to a CSV file so that I can view them en masse?
Solved! Go to Solution.
Thanks. I was trying to avoid having to get a developer involved or getting access to the database. I can write a PHP program to do it myself. If I had access to the DB, I would likely just use PHPMyAdmin to dump the table to a CSV. I have since discovered the client has Firebear Import/Export on their installation. I can use that to dump the table I believe. Going to play around with it today.
Thanks again!
Hello @jimjahodso001d
In Magento 2, exporting URL rewrite/redirect data isn't available directly via the admin panel, but there are workarounds using either the command line interface (CLI) .
Create a custom PHP script to extract the data from the database and export it as a CSV file.
<?php require_once 'app/bootstrap.php'; use Magento\Framework\App\Bootstrap; $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $urlRewriteFactory = $objectManager->get('Magento\UrlRewrite\Model\UrlRewriteFactory'); $connection = $objectManager->get('Magento\Framework\App\ResourceConnection')->getConnection(); $sql = "SELECT * FROM url_rewrite"; $result = $connection->fetchAll($sql); $csvFile = fopen('url_rewrite_collection_export.csv', 'w'); fputcsv($csvFile, ['URL Rewrite ID', 'Store ID', 'Request Path', 'Target Path', 'Redirect Type', 'Is Autogenerated']); foreach ($result as $row) { fputcsv($csvFile, $row); } fclose($csvFile); echo "URL Rewrites exported in CSV file successfully!"; ?>
Hope it helps !
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9
Thanks. I was trying to avoid having to get a developer involved or getting access to the database. I can write a PHP program to do it myself. If I had access to the DB, I would likely just use PHPMyAdmin to dump the table to a CSV. I have since discovered the client has Firebear Import/Export on their installation. I can use that to dump the table I believe. Going to play around with it today.
Thanks again!