How to Redirect Known Pages and Wildcard for Everything Else with htaccess

Browse My Free Website Guides

I recently worked on a project which needed me to shut down a WordPress blog and migrate it’s content. I had about 20 posts and pages that were going to migrate but everything else was going to be deleted. Since htaccess runs their commands from the top to the bottom, place your known redirects above your catch all redirect.

# redirect the posts and pages that moved - list all known urls below
Redirect 301 /known-path/

# Redirect old directory and child pages to a new directory name
RewriteRule ^/category/solutions/(.*)$$1 [R=301,NC,L]

# Redirect everything else to the new domain homepage
RedirectMatch 301 ^


Related resources

  • HubSpot CMS vs WordPress: Feature Comparison and Review
  • 25+ Questions to Ask Before Redesigning Your Business Website
  • 5 Things A Business Should Consider Before a Website Redesign
  • How to Get a Responsive Website for Your Manufacturing Company
  • What Is a Good WordPress Alternative for Businesses?
  • Tags: ,

    Want to Get Email Updates of New Posts? Join My Email Newsletter