.htaccess rewrite help for wordpress permalink change - wordpress

I need some help with an .htaccess rewrite.
I have a site that had this permalink:
/archive/%post_id
and changed it to this:
/%postname%/
I have tried every single permalink redirect and change plugin - none of them work for this scenario.
The site has 15,000 posts, adding one line 301 redirects in the .htaccess file isn't going to work.
Can someone help me add a rewrite that will redirect all instances of /archive/%post_id to /%postname%/ ?
any help appreciated!

I know you said you tried all the plugins, but just in case, did you try this one:
http://www.shoutmeloud.com/how-to-use-deans-permalink-migration-plugin-for-wordpress.html
Looks like it dynamically creates 301s for you without SEO damage. Written in 2006, still working in 2009 - you might be able to tweak the code to get it working how you want.
If that is the 'quick' solution then the 'long' solution would be to write an app to lookup the postname by postid in your mysql db and then change each post URL in your wordpress database with the postname value.

Related

Redirect Urls with Wordpress Variables

I want to change the permalink structure of my website from
../%postname%/
to
.. /%categroy%/%postname%/
The problem is that there are many backlinks which still link to /%postname%/ and those would return a 404. I tried using plugins but they wont let me use the variables from wordpress.
Now, I want to create a redirect for all those old Backlinks which redirect from
../%postname%/
to
.. /%categroy%/%postname%/
I guess an easy solution would be to modify the htaccess file but I have no idea how to do this? Or are there actually any plugins which handle that problem?
I would appreciate any help.
Thanks.
you may check this plugin this will help for variable redirect for users
https://wordpress.org/plugins/peters-login-redirect/

Redirect /123/POST to just /POST in wordpress using .htaccess Rewrite Rules

I have a website running wordpress with some good amount of posts.
For a specific reason, i setup my wordpress permalinks structure to /%post_id%/%postname%/
Now i want change my permalink structure to /%postname%/ for supporting a plugin Category Subdomain Pro
When i change the change the permalink structure, new links are working but i am getting a 404 error for old urls.
So, i am thinking about redirecting old urls to new urls.
If you know anything about this, please share something and help me resolve this issue.
Sorry for delay, Check this out... Before # BEGIN WordPress in .htaccess file put this code...
Redirect 301 /post_id/postname/ http://example.com/postname/
just replace post_id,postname to your website posts id and post name. Replace example.com with your website name and postname with your postname.
replace for every single post
or you can use plugin Redirection

WordPress permalink structure change re-direct htaccess

I currently have a website using the permalink structure:
http://xxx.xxx/%postname%/
I want to change this to:
http://xxx.xxx/xxx/%postname%/
So basically giving the default post type a slug rewrite like you can with CPT.
However, as we all know all the indexed pages will 404 so I need to write some HTACCESS to but not sure what I need.
If I use the following then all pages are re-directed too:
RedirectMatch 301 ^/([^/]+)/$ http://xxx.xxx/xxx/$1
Where as I just want the default post type re-directed.
Thanks
This cannot be done, you need to completed 301 redirects for each post and tag.
Have blogged about my process here: http://www.chewx.co.uk/2015/wordpress-permalink-update-from-postname/
If anyone can think of a better way, let me know.

Changing category slug messes incoming links to posts in Wordpress

I have wordpress site on say: http://xyz.com/category-name/
now I changed the category slug to new-category-name
When I paste this in the browser:
http://xyz.com/category-name/post-name/
it redirects me to
http://xyz.com/new-category-name/
instead of
http://xyz.com/new-category-name/post-name/
I already tried
something like:
RewriteRule ^category-name/(.*) http://xyz.com/new-category-name/$1 [R=301,L]
but it does not work...
how can this be fixed?
It looks like the server cached the old .htaccess for a while. Now it started to work as expected.
Have you heard of the redirection plugin?
http://wordpress.org/extend/plugins/redirection/
One of the most powerful features is it tracks changes in post URL's and creates 301 redirects to the new pages automatically... saved me a ton of work.
Try refreshing the permalink structure going to Settings->Permalinks.

Wordpress Permalink Structure 301 Redirect

Currently I am using Wordpress v3.4 and using the following Permalink Custom Structure
/%category%/%postname%-%post_id%.html
Now I want to remove .html from it so I did like this
/%post_id%/%postname%/
I want to 301 redirect from old structure to new one.
Does anyone have the solution or suggestion?
Just use Redirection WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have.
Honestly, you should have never had put the extension, honestly I am surprised that Wordpress allowed this. However, if you change the permalink structure, usually it updates all previous posts and pages. Is that not the case here?

Resources