Mobile app version of vmapp.org
Login or Join
Megan663

: Fastest way to redirect dead URLs to home page A client of mine scrapped his entire wordpress site of many years for a custom CMS. The URL structures both use the /<post_title> format,

@Megan663

Posted in: #301Redirect #Apache #Redirects #Wordpress

A client of mine scrapped his entire wordpress site of many years for a custom CMS. The URL structures both use the /<post_title> format, so a pattern based .htaccess rule is out of the picture for saving the old urls. The old site is effectively dead, but I'd hate to let all of those thousands of backlinks simply die a 404 death.

Is there a faster way than listing each url in a .htaccess directive to redirect 1000s of urls to the home page? (Faster as in load speed, not programming efficiency)

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

3 Comments

Sorted by latest first Latest Oldest Best

 

@Gloria169

Have you thought about adding a string to the new URL's and then do a regex in Apache config to 301 redirect all URL's that don't match the string? You should certainly do 301 redirects to retain the value of the backlinks.

10% popularity Vote Up Vote Down


 

@Radia820

You can add "ErrorDocument 404 /404.php" to the .htaccess file and setup a php redirect on 404.php.

10% popularity Vote Up Vote Down


 

@Ann8826881

In your custom 404 page you could check the structure of the URL and 301-redirect if it looks good - or preferably look it up against a known list of previous Wordpress URLs.

At least this way you are only doing the lookup/redirect if the page doesn't exist.

If you are doing 1000s of redirects with Apache, it will be more efficient/faster to do this in your server config (vhost) files.
Ref: Move .htaccess content into vhost, for performance

EDIT: I expect you've considered this already, but the thought was beginning to nag... do these missing pages have equivalent new URLs? Although a lot more work, it will obviously be many(*N) times better (for SEO and users) to redirect to the new URL if possible.

(Where N is a sufficiently large arbitrary number.)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme