Search code examples
wordpresshttp-redirectpermalinks

Wordpress 301 Redirect


I have got one Wordpress blog site and I use permalink as:

%category%/%postname%.html

I want a change as:

%postname%.html

And now old urls (https://www.example.com/category/post-name.html) 301 redirect to (https://www.example.com/post-name.html).

How can I redirect with use .htaccess file?


Solution

  • Just go to wp-admin, then /settings, then /permalinks and select "Post name". More info on that here: https://codex.wordpress.org/Using_Permalinks

    For 301 redirects you can write your own to your htaccess file but this is probably not as easy as using a plugin like Simple 301 Redirects.