markdefacto
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: cutenews to wordpress redirecting old urlsNo one ever responded but here is the solution I came up with. I found what things are unique to cutenews and won’t appear in a wordpress url and wrote something in .htaccess. It captures the unique article id or the unique category id from cutenews and passes them to a php script I made called cutenewsredirect.php. cutenewsredirect.php in turn redirects them to the correct website giving the 301 (moved permanently) status.
.htaccess:
# redirect the old cutenews articles RewriteCond %{QUERY_STRING} (.*)(subaction|start_from)(.*)id=([0-9]+)(.*) RewriteRule ^.* https://www.newsite.com/cutenewsredirect.php?article=%4 [L] # redirect the old cutenews categories RewriteCond %{QUERY_STRING} (.*)category=([0-9]+)(.*) RewriteRule ^.* https://www.newsite.com/cutenewsredirect.php?cutecats=%2 [L]
cutenewsredirect.php:
<?php switch ($_GET["article"]) { case "3141592": Header("HTTP/1.1 301 Moved Permanently"); Header("Location: https://www.newsite.com/pi-is-great"); break; case "8675309": Header("HTTP/1.1 301 Moved Permanently"); Header("Location: https://www.newsite.com/a-new-page/"); break; } switch ($_GET["cutecats"]) { case "1": Header("HTTP/1.1 301 Moved Permanently"); Header("Location: https://www.newsite.com/category/foobar/"); break; } ?>
Viewing 1 replies (of 1 total)