I believe I’ve found the solution. I add the following
RewriteRule ^example_directory/files/(.*) new_directory/$1
to my WordPress .htaccess rules like so:
RewriteEngine On
RewriteBase /
RewriteRule ^example_directory/files/(.*) new_directory/$1
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
I couldn’t get it working before and I think the key was moving the new RewriteRule
directive to the line directly following RewriteBase /
Related Posts:
- custom htaccess rewrite rule for page
- Why is there /index.php/ in all my links? How do I remove it?
- subdirectory install breaking existing links
- Preserve old website URL structure after migrating to WordPress
- WordPress is adding “category” word before my actual category name in url (and this is unsolicited)
- Migration from old CMS to WordPress 301 redirection rules?
- Change author base slug for different roles
- Masking wp-content/themes/name/images to just images directory using htaccess
- Using custom/dynamic “slug” for a page
- Passing parameters to a custom page template using clean urls
- How to add custom rewrite rule to .htaccess?
- Use subdomain for certain urls
- Display posts with author in the url with custom post types
- Clash of the rewrites
- How to seamlessly redirect between different archive and singular slugs?
- How to change default page slug?
- Hijacking the URL for filtering
- Custom rewrite rules are sending everything to index.php
- How to change ?lang=cn into /cn/
- unexpected problem in url rewrite
- Redirecting all old links from previous EE site to new WP site in one go?
- Two “.htaccess” Files Located in Different Directories?
- Rewrite WordPress Custom URL
- Multiple Permalinks for Same Post
- Issue with using .htaccess to redirect feedburner feed
- Adding more pages to author pages
- Custom rewrite rule
- Add query string to url and display it as normal url part /folder/
- WordPress .htaccess – route other URLs to another app
- Removing “category” from URLs then “add_endpoint()” won’t work…
- hard flush_rewrite_rules() not regenerating .htaccess
- Cleanup URL for a custom page in wordpress
- WordPress rewrite rules don’t need ^?
- Changing RSS feed URL structure
- add_rewrite_rule fro html to another url not working
- Adding rewrite rules directly to .htaccess file
- NextGEN Gallery Lightbox – Social Share URL Redirect
- WordPress .htaccess blocks mine?
- Preserve Domain Alias
- My WP_options db rewrite_rules Does Not Work
- Disable Pagination on Pages
- Rewrite Preview URL to include index.php
- WordPress Redirecting Non Category Pages /page/nnn to their Canonical URLs
- How can I dynamically generate an image with a static image URL?
- How to remove wordpress directory slash
- Changed pagination URLS to use p= instead of paged=
- “View post” leads to odd URL
- React Router with WordPress
- joomla to wordpress migration and 404 errors issues [closed]
- Map secondary domain to other’s virtual subfolder
- How to change the Author Slug from Username to Nickname and deal with Special Characters
- Customise particular RSS permalink
- htaccess rewrite, adding segment to url
- RSS feed rewrite matching wrong rule
- Redirect to another page using contact form 7? [closed]
- How to change custom post type slug
- ow to change cutsom page url of wordpress site using htaccess
- Redirect htaccess [closed]
- force www rewrite if wordpress put in a folder
- One off rewrite for single post-type slug (show normal page with same URL instead)
- How do I make WordPress revise an .htaccess file a certain way?
- Can’t use a specific custom URL (slug)?
- Rewrite rule that wp-login.php?action=register is left alone
- Make the home page’s slug visible in the browser’s URL bar
- Trying to add array of paths to post permalink
- Rewrite htacess rule doesn’t work
- Translatepress taxonomy and custom post type root FIX
- WordPress URL redirect and replace ? question mark
- Multiple permalink with and without category for same post
- Custom Params in URL
- Change author base and slug in author link
- Pretty URL via Rewrite
- Fresh install redirects to www, breaking page loads
- Rewrite Url using .htaccess or hook
- WordPress numeric (yearly) page names / disable yearly archives
- Is it possible to rewrite a page URL from ID to name from an API?
- Root-relative paths being rewritten on ‘Edit Page’ [closed]
- Moved WordPress to Subdirectory, still hijacking requests to files outside of its directory
- How to add 2 variable rewrite rule?
- Rewrite URL query string for all pages
- Url wordpress rewrite
- Add ReWrite from Old Pages to WordPress (remove .php)
- ModRewrite not working properly
- taxonomy term in URL slug won’t forward to the correct term for custom post like it does for default categories/normal posts
- Fully mask *all* traces of WordPress installation subdirectory?
- Remove Page Slug from URL
- Needed to change slug to access page
- .htaccess RewriteRule to include post type and taxonomy
- Redirect A URL Pattern In WordPress Using .htaccess
- URLs unchanged after migration
- URL rewrite results in a 404, but everything should work!
- Rewrite Question
- Stop wordpress to redirecting home page if no page found
- Pagination posts. Url format
- Additional .htaccess rules based on wp page
- Changes done to .htaccess are not getting reverted back
- WordPress total posts per page changed and now 404 Http error comes out [closed]
- how to rewrite folder name in url to another name
- Add rewrite endpoint and .htaccess
- WP-Include rewrite directory