<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MatrixInn Solutions Blog]]></title><description><![CDATA[Practical guides from MatrixInn Solutions, the team behind WA Float for Shopify, MatrixInn PiP for Chrome and 19 free developer tools. We write about web develo]]></description><link>https://matrixinn.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6abc3cbd9f26eaf6f35abeef/2e5e09e4-2eef-4b28-9f0e-5ffe433fe02b.png</url><title>MatrixInn Solutions Blog</title><link>https://matrixinn.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 06 Oct 2026 17:31:03 GMT</lastBuildDate><atom:link href="https://matrixinn.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Bulk 301 Redirects in .htaccess: A Step-by-Step Guide]]></title><description><![CDATA[Originally published on the MatrixInn Solutions blog.
When you change URLs — a redesign, a new CMS, merging blog posts, moving to a new domain — every old URL that isn't redirected turns into a 404. V]]></description><link>https://matrixinn.hashnode.dev/bulk-301-redirects-htaccess</link><guid isPermaLink="true">https://matrixinn.hashnode.dev/bulk-301-redirects-htaccess</guid><category><![CDATA[SEO]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[apache]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Huzaifa Alam]]></dc:creator><pubDate>Tue, 29 Sep 2026 22:47:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6abc3cbd9f26eaf6f35abeef/b588f02f-db6b-4b59-acf9-409cef003b82.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Originally published on the <a href="https://matrixinnsolutions.com/blog/bulk-301-redirects-htaccess">MatrixInn Solutions blog</a>.</em></p>
<p>When you change URLs — a redesign, a new CMS, merging blog posts, moving to a new domain — every old URL that isn't redirected turns into a 404. Visitors hit a dead end, and the ranking signals that page earned stay stuck on a URL that no longer exists. A <strong>301 redirect</strong> tells browsers and search engines the page has moved permanently and passes those signals to the new address.</p>
<p>Redirecting one page is easy. Redirecting 200 is where people make mistakes. Here's a process that works for any size of migration.</p>
<h2>Step 1: Build your redirect map in a spreadsheet</h2>
<p>Make two columns: <strong>old path</strong> and <strong>new URL</strong>. One row per page.</p>
<table>
<thead>
<tr>
<th>Old path</th>
<th>New URL</th>
</tr>
</thead>
<tbody><tr>
<td>/services/web-design.html</td>
<td><a href="https://example.com/services/web-design">https://example.com/services/web-design</a></td>
</tr>
<tr>
<td>/blog/2019/05/my-post</td>
<td><a href="https://example.com/blog/my-post">https://example.com/blog/my-post</a></td>
</tr>
<tr>
<td>/shop/blue-jacket</td>
<td><a href="https://example.com/products/blue-jacket">https://example.com/products/blue-jacket</a></td>
</tr>
</tbody></table>
<p>Where to get the old URLs:</p>
<ul>
<li>Your <strong>old sitemap.xml</strong> (the best source)</li>
<li><strong>Google Search Console → Pages</strong>, and the Performance report sorted by clicks. Prioritize URLs that actually get traffic</li>
<li>A crawl of the old site with Screaming Frog or a similar crawler</li>
</ul>
<p>Map every old URL to its <strong>closest equivalent</strong>, not to the homepage. Google treats mass redirects to the homepage as soft 404s, and the ranking signals are lost anyway.</p>
<h2>Step 2: Generate the rules</h2>
<p>For simple one-to-one moves, Apache's <code>mod_alias</code> is the cleanest option:</p>
<pre><code class="language-apache">Redirect 301 /services/web-design.html https://example.com/services/web-design
Redirect 301 /blog/2019/05/my-post https://example.com/blog/my-post
Redirect 301 /shop/blue-jacket https://example.com/products/blue-jacket
</code></pre>
<p>If your <code>.htaccess</code> already uses <code>RewriteRule</code> (WordPress, most PHP frameworks), keep everything in <code>mod_rewrite</code> so the two modules don't fight over the same request:</p>
<pre><code class="language-apache">RewriteEngine On
RewriteRule ^services/web-design\.html$ https://example.com/services/web-design [R=301,L]
RewriteRule ^blog/2019/05/my-post$ https://example.com/blog/my-post [R=301,L]
RewriteRule ^shop/blue-jacket$ https://example.com/products/blue-jacket [R=301,L]
</code></pre>
<p>Notice the escaped dot (<code>\.html</code>) and the <code>^…$</code> anchors. Without them, <code>/shop/blue-jacket</code> would also match <code>/shop/blue-jacket-xl</code>.</p>
<p>Writing hundreds of these by hand is slow and error-prone, and one stray space can return a 500 error for the whole site. Instead, copy your two spreadsheet columns into our free <strong><a href="https://tools.matrixinnsolutions.com/htaccess-redirect-generator">.htaccess redirect generator</a></strong>, open <strong>Bulk paste</strong>, and click <strong>Import &amp; generate</strong>. It trims full URLs down to paths, escapes regex characters, and outputs either <code>Redirect</code> or <code>RewriteRule</code> lines. It all runs in your browser, so your URL list is never uploaded.</p>
<h2>Step 3: Put the rules in the right place</h2>
<ol>
<li><strong>Back up</strong> your current <code>.htaccess</code>.</li>
<li>Paste the redirects <strong>near the top</strong>, after <code>RewriteEngine On</code> but <strong>before</strong> any catch-all rules (like WordPress's <code># BEGIN WordPress</code> block). Apache processes rules top to bottom, and a catch-all placed earlier will swallow your redirects.</li>
<li>Put more specific paths above broader patterns.</li>
</ol>
<h2>Step 4: Avoid the three classic mistakes</h2>
<p><strong>Redirect chains.</strong> If <code>/a</code> already redirects to <code>/b</code>, and you now move <code>/b</code> to <code>/c</code>, update the first rule to go straight to <code>/c</code>. Every extra hop slows the page down and loses a little signal. Keep every redirect to a single hop.</p>
<p><strong>Redirect loops.</strong> A rule whose destination matches its own pattern (or another rule that points back) loops forever and the browser shows "too many redirects". A common version of this: a rule that strips trailing slashes fighting Apache's own <code>DirectorySlash</code>, which adds them back to real folders. Test folder URLs specifically.</p>
<p><strong>Using 302 by accident.</strong> <code>R</code> on its own in a <code>RewriteRule</code> means <strong>302</strong> (temporary). For permanent moves always write <code>R=301</code>.</p>
<h2>Step 5: Test before you trust it</h2>
<p>Check a sample of old URLs from the command line:</p>
<pre><code class="language-bash">curl -I https://example.com/blog/2019/05/my-post
</code></pre>
<p>You want <code>HTTP/1.1 301 Moved Permanently</code> and a <code>Location:</code> header with the new URL, and that new URL should return <code>200</code>, not another redirect. For a big list, loop through your old paths in a script, or run a crawler in list mode over the old URLs.</p>
<p>Then in Google Search Console:</p>
<ul>
<li>Submit the <strong>new</strong> sitemap.</li>
<li>Watch <strong>Pages → Not found (404)</strong> over the next few weeks for anything you missed, and add a redirect for each one.</li>
</ul>
<h2>How long should redirects stay?</h2>
<p>Keep them for <strong>at least a year</strong>, and ideally permanently. Other websites, bookmarks and old social posts keep linking to your old URLs long after Google has updated its index. Removing redirects early throws that traffic away.</p>
<h2>Quick checklist</h2>
<ul>
<li> Every old URL with traffic or backlinks is in the map</li>
<li> Each maps to its closest new equivalent (not the homepage)</li>
<li> One module style (<code>Redirect</code> <em>or</em> <code>RewriteRule</code>), placed before catch-all rules</li>
<li> <code>R=301</code>, anchored patterns, escaped dots</li>
<li> No chains, no loops, and folder URLs tested</li>
<li> New sitemap submitted; 404 report checked weekly</li>
</ul>
<p>Need to generate the rules now? Paste your list into the <strong><a href="https://tools.matrixinnsolutions.com/htaccess-redirect-generator">free bulk .htaccess redirect generator</a></strong>. Planning a bigger migration or rebuild? <a href="https://matrixinnsolutions.com/start">Talk to us</a>.</p>
]]></content:encoded></item></channel></rss>