Add this to your .htaccess
below the # END WordPress
line:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST}
RewriteRule ^(.*)/(.*).html$ news/$2/.html [L,R=301]
</IfModule>
This will redirect domains such as:
http://example.com/category/post-name.html
To the following:
http://example.com/news/post-name/.html
Related Posts:
- 301 Redirects for Changed Permalink Structure & Category Base
- How do I turn off 301 redirecting posts (not canonical)?
- Passing variables through permalink structure
- htaccess or redirect to cloak portion of a link?
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- Using WP rather than .htaccess to redirect pages/posts
- .htaccess – Redirect duplicated post ended in ‘-number/’ to the same url without the -number/
- WordPress redirection problem after moving to a new server?
- Specific URL Rewriting with parameters in wordpress
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- Redirect parent taxonomy to it’s child
- Need Help Correct Regular Expression Redirect Code
- Custom Permalink
- Redirect a Blogger Page URL to wordpress
- Redirecting all posts after changing URL structure with htaccess
- WordPress 4.4 old permalink redirect
- Htaccess https 301 problem
- How to use different domains for different blogs hosted in the same host in subdomains with .htaccess
- What causes /pages/ to appear in URI, and how to remove it?
- Some Pemalink problems, probably caused by wrong .htaccess configuration?
- Test site pages go to main site
- Comment author url link is wrong? How to change from authors/ to author/
- change WordPress permalinks and redirect new urls 301
- Custom permalink structure with %postname% in front of domain name
- Configuring Home Page Address
- Can’t access WordPress site in subfolder possibly because of .htaccess redirect from root installation?
- Removed and Reinstalled WordPress, Redirect Broken now
- redirect old pages by .htaccess
- Why are all pages redirecting to homepage when using custom permalinks?
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- 404 posts error after 301 redirection of changed category / tag base
- 301 Redirect posts to newly added categories
- Move WordPress to subdirectory, keep ALL URLs
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- How can I include a query string with get_permalink
- Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- custom naming of search permalink /search/
- Rewriting search permalink
- removing index.php IIS 7.5 webconfig
- Rewrite rule never matching
- Redirect user if it’s not logged in
- Random Alphanumeric Key URLs
- Custom url for a single page
- Rewrite-Rules not working on a vhost, everything goes to index.php
- What happens when permalink settings are updated?
- Change of permalink structure – redirects in htaccess breaks the archive links
- How can I make my .htaccess file writeable by wp-admin?
- How to 301 all posts
- 404 with post name permalinks
- Why does chrome keep downloading a file instead of running the site?
- Permalinks not working
- WordPress 404 in development area
- Does rename of page slugs create 301 redirects from old slug to new (same as for posts)?
- Change in permalink structure made javascript cookie not work correctly
- List / Get post redirects
- Redirect /%year%/%monthnum%/%day%/%postname% [closed]
- 301 Redirect for Non-Date Based URL’s
- Passing the JQuery string to Worldpress URL
- An other permalink problem – 404 Error
- WordPress Not Using Template Files After Permalink Update
- Permalinks settings
- How to prevent WP overwriting my custom htaccess rewrites?
- mod-rewrite exception? keep #hash in matching urls?
- .htaccess rewriterule being ignored – tyring to remove dates from WP posts
- Permalink for specific page name
- How to redirect RSS feeds to Feedburner and keep pretty permalinks?
- Strange behavior with a redirect loop – involves WPML multi-language plugin
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- WordPress not generating .htaccess but tells me that (Permalink structure updated.)
- Arabic permalink redirect to home page
- Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?
- Ignore postname in permalink
- Permalinks – .htaccess
- old permalinks not found
- mod-rewrite rules grabs “broken permalinks”, too
- How to redirect old permalinks from https://exmaple.com/category/post_id to https://exmaple.com/category/post_id.html
- Redirect old /%category%/%postname%/ to just /%postname%/
- why wordpress keeps redirecting to old page after deleting it?
- 301 redirects after changing permalinks
- Change permalink structure with post id
- WordPress All pages but home simply read “hello”
- Issue with my links or permalinks
- How to rewrite a folder in WordPress?
- Fresh wordpress installation in sub-directory not accessible
- Folder Name and Category Name WordPress
- WordPress permalink still not working (error or not understood?)
- customize urls displayed by previous_post_link and next_post_link
- .htaccess not working in WordPress
- Pagination is not working, how to trace it properly?
- Problem when i configure permalink
- custom permlink .htaccess file 404 Not Found error
- Files placed in directory with wordpress 404
- 404 not found error on WordPress local host
- Add segment to URL in htaccess
- htaccess strip url
- Pages resolve at different URLs (different capitalizations)
- Standard Htaccess directives disappear by themselves
- WordPress not remembering old slugs for pages