Or you could just add the relevant directive to the top of the .htaccess file directly. For example:
RewriteRule ^([^/]+)\.html$ /product/$1 [R=302,L]
This matches /anyname.html (as in your example), but not /foo/bar/anyname.html.
Related Posts:
- Server (WordPress) redirects files that are not supposed to (using htaccess)
- Alias ‘wp-content’ directory to something shorter (framework?)
- Wildcard forward all posts and pages with few exceptions
- Is WordPress API visible from PHP file called in htaccess
- Clash of the rewrites
- Will references to ugly links automatically redirect to their pretty url permalink?
- Hijacking the URL for filtering
- WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)
- custom htaccess rewrite rule for page
- Redirecting all old links from previous EE site to new WP site in one go?
- Prevent WordPress from automatically correcting URLs
- Rewrite WordPress Custom URL
- Custom rewrite rule
- WordPress .htaccess – route other URLs to another app
- Is there a ‘rake routes’ for wordpress?
- Changing RSS feed URL structure
- Double domain name in category URL-s
- Preserve Domain Alias
- WordPress redirects non-existing url to existing ones – how to disable
- Rewrite Preview URL to include index.php
- How to disable URL rewriting for specific URLs?
- How do I display only the parent page in the url
- How to remove wordpress directory slash
- React Router with WordPress
- How to redirect large amount of URLs?
- Redirecting /px/?q=x to /px/x/
- URL redirect on updating the post date
- Rewrite vs Redirect from ?p={ID}
- Redirect htaccess [closed]
- 301 Rewriting htaccess
- 404 redirect based on url
- How to customize sub-URLs in a wordpress website (.htaccess)
- WordPress is adding “category” word before my actual category name in url (and this is unsolicited)
- Multiple permalink with and without category for same post
- Fresh install redirects to www, breaking page loads
- Rewrite URL to get rid of wp-content etc and change URL
- taxonomy term in URL slug won’t forward to the correct term for custom post like it does for default categories/normal posts
- How to create short urls for sharing and downloadable content?
- Redirect A URL Pattern In WordPress Using .htaccess
- Migration from old CMS to WordPress 301 redirection rules?
- Changes done to .htaccess are not getting reverted back
- Allow requests to resources outside the wordpress folder
- Override default url for author pages?
- Multiple endpoints to same page
- How to prevent redirection to max 2147483647 for larger values of the page query variable?
- Add forward slash on categories url (serve one version of a url)
- how to add prefix to post url structor only
- How do I remove a word from a url in WordPress using .htaccess?
- Rewrite rules in .htaccess get overwritten?
- Dynamic URL, not a physical page within the database
- Passing & Reading URL Parameters with URL re-writing
- Change default URL of image attachment
- Display content according to current URL
- WordPress redirection to get url friendly
- External/non-WP rewrite rule without QSA
- Remove special characters in a URL
- open all .docs in word online
- How to disable the default WordPress redirect to non-www URLs?
- How to add custom variable in url without redirect?
- Adding pretty query parameters
- How to redirect http://mydomain/blog/blahblah/ to http://mydomain/blahblah/ in wordpress htaccess?
- How to change the main site url on a multisite installation (network)?
- Append a query string to the end of every URL
- How to redirect URL with subfolder to the same URL but without subfolder?
- .htaccess rewrite
- Change htaccess to redirect to index.php in subfolder
- Cannot access wp-admin without trailing slash – .htaccess configuration for WordPress behind a nginx proxy
- Help with Rewrite Rule for Custom Post Type with Query String
- Replace specific middle part of url
- Rewriting a subdomain page on one WordPress installation to a parent domain on another
- How to change the Author Slug from Username to Nickname and deal with Special Characters
- Changing URL scheme, mod_rewrite not helping
- How do I Redirect a WordPress Page?
- Re-directing URLs with dates to URLs without dates
- Having WordPress control only certain pages with .htaccess?
- wordpress url correction
- Flushing rewrite rules
- Help with a custom rewrite
- Rewrite specific action url
- Overwrite WordPress’s URL rewrite not working
- Get logged in username in wordpress url
- URL problem: www.sitename.com/blog and www.sitename.com/learn using same WP installation
- WordPress 3.1.2 Network Enabled non-www to www
- Exclude subfolder in WordPress permalink
- Point 404 pages to homepage
- WordPress pagination broken for page 2,3 with custom permalink. Redirects to baseurl
- Help with .htaccess setup to hide WordPress Directory
- Rewrite URL for attachments
- How to add gallery slug to attachment url?
- Pagination appearing twice in URL after rewrite
- URL Rewrite for CPT single posts
- Simple URL rewriting gone wrong
- What is the proper way to use add_rewrite_rule to remove the (question mark)?
- WordPress post-type create url rewriting
- How can i maintain permalink structure and avoid a 404 error when loading external content?
- Can’t get pretty permalinks to work without index.php
- How to redirect a virtual page (e.g. /blog) to the home page?
- WordPress 3.0 Multisite – Child sites and backends appearing blank
- How to rename the WordPress wp-login.php running on IIS6?
- Using .htaccess to redirect /da/ to / in URL