質問

I used to have a Wordpress custom post type, actually had a few, that were 'accidentally' deleted during some recent server problems.

Each one (custom post type) only had a number of posts attributed to it, so I decided not to go through the bother of recreating them and repopulating them, but instead decide to just try and 'forward' any of these URL requests to my main blog, imjustcreative.com/blog/

Obviously I'm seeing some 404's being generated as these posts did get indexed, and they are being requested on time-to-time. So I'm simply trying to tidy up these loose ends.

What would be the most efficient way to ensure that any URL request that starts with: imjustcreative/linkedlist/ but does contain the actual post string after, of which there are a few, for example: imjustcreative/linkedlist/awesome-post can be redirected back to a the single blog index url, instead of popping up a 404.

So if I'm seeing: http://imjustcreative.com/linkedlist/blah-blah and http://imjustcreative.com/linkedlist/blahblachnom coming up as 404's, rather than creating individual post redirects imjustcreative.com/blog/ is there a way to simply state that any thing includes with imjustcreative.com/linkedlist/ and regardless of what post title comes after is picked up by a single redirect?

役に立ちましたか?

解決

You can put this rule in your htaccess (which should be in document root folder in this case) right after RewriteEngine on

RewriteRule ^/?linkedlist/ /blog/ [R=301,L]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top