Redirect for wordpress permalink - wordpress

I'm trying to change the WordPress permalink structure in .htaccess from /%postname%/ to /%category%/%postname%/ any suggestions?

Yup ditto what Prix said. The WordPress permalink structure rewriting is done internally with php code. Rewriting is done in the root .htaccess file, but permalink structures are handled internally by WordPress. When you save WordPress Permalinks an .htaccess file will be automatically created in your website root folder. The internal Permalink structure rewriting done by WordPress relies on this root .htaccess file in order to correctly perform rewriting.
Permalink Structure Tags are not used in .htaccess code or files and are an internal rewriting feature of WordPress. Or in other words, simply that Permalink Structure Tags are not used in .htaccess code or files.

Try this
http://yoast.com/change-wordpress-permalink-structure/
Look for the orange "generator" button, it does the job for you.

If i'm not wrong, inside the settings on the "permalink" voice you can modify this last one.
Just remember to put the correct .htaccess inside your website:
https://codex.wordpress.org/htaccess
Usually to use correctly the permalink you have to use %postname% on the personalized structure.

Related

Make WordPress' default posts go to /blog -- permalinks not working

Consider the following post types
Posts (default in WordPress)
Accessories (Custom post type)
I want posts to go to /blog. Accessories slug has been defined as /accessories.
To achieve this, in settings > permalinks > and have defined my custom structure as /blog/%postname%/.
With this, when I go to /blog/, I get a 404. However, when I create a post in posts, the permalink shows up as /blog/test-title.
Also, with the custom structure set, when I try and go to /accessories, it also 404's.
Questions:
Why does /blog 404? It should use index.php as it's template, no?
Why does /accessories 404 with this change?
How do I get /blog and /accessories working?
To get this WordPress permalink stuff to work correctly, the underlying apache web server grabs the incoming URL requests and rewrites them underneath the covers so they point to /index.php?something=something. For this to work, apache must
have an extension module called mod_rewrite enabled,
be configured to allow rewriting in your WordPress instance, and
be able to write a file called .htaccess in the same folder as your WordPress index.php.
You didn't mention what kind of OS your server lives on, so it's difficult to give you specific advice. You might check Digital Ocean's fabulous documentation for help.

How to redirect links from structure to another

My site Permalinks structure is: /%post_id%/%postname%/
/%post_id%/
and
/%post_id%/%postname%/
are working correctly and showing the same content
I want to redirect every link with
/%post_id%/ structure
to
/%post_id%/%postname%/ structure without change Permalinks structure
Is there any way to do that using WordPress plugin or htaccess code?
The problem has been solved using Redirection plugin
permalink settings
Redirections plugin settings

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

Change permalink structure with htaccess - wordpress?

I want to change my old domain name to new domain. What I ask here is how to redirect permalink structure with htaccess from
http://www.OldDomain.com/postname/ to http://NewDomain.com/postid/postname/
/%postname%/ /%postid%/
Straight answer is NO, you must not do this via .htaccess.
Wordpress already supports (and enforces) this permalink structure so it is much better and cleaner to goto Wordpress admin panel and change the permalink structure to /%postid%/%postname%/ in the newer installation of Wordpress.
PS: Note that even if you rewrite these URLs differently via mod_rewrite, WP will enforce and expect this to whatever is defined in it permalink definition.

.htaccess rewrite help for wordpress permalink change

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.

Resources