With some help (also asked on SO, as this wasn’t a strict WP question), and some testing, the following ended up working for me (added a slash just before the $
sign):
RewriteRule ^galleries/(.*)/$ /portfolio/$1 [R=301,NC,L]
As the galleries are actual directories, not files, they have a slash at the end:
http://subdomain.example.com/galleries/headshots/
Here ---^
Related Posts:
- Place static HTML files in path below WordPress page
- htaccess, site and staging in subdirectories
- I have a page using a pretty url and a mod_rewrite rule matching it. I expected it to give an error but it’s working. Why?
- File and directory permissions
- htaccess rewrite for author query string when WP is in subfolder
- .htaccess for wordpress inside another wordpress install
- Isolating WordPress to a subfolder
- Remove year and month in URL using .htaccess
- Permalinks not working on second wordpress installed in a subdirect
- Move wordpress to folder without changing urls
- Rewrite rule not working
- Change wp-content without changing the name of the folder
- How to restrict access to wp-content, wp-includes and all sub-folders
- .htaccess redirects disappeared after re-saving permalinks
- Protect Upload Folder Files With Ampersand Problem
- Remove File Extension for Page Outside of WordPress
- WordPress URL/Folder ReWrite using Htaccess
- WordPress mod_rewrite is canceling/overwriting my other mod_rewrite rule
- Redirect main domain to subdirectory
- Exclude subfolder from WP-redirect works with html but not php files
- Can’t Access Subdirectory
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- Override htacces rule only for specific directory
- Fixing custom 404 pages broken by WordPress in a subdirectory
- WP install in sub-dir white screen
- Drawbacks to using Options -Indexes
- WordPress installed in root, need second in subdirectory with different domain
- mod_rewrite loop, redirecting http to https on certain section of wordpress blog
- blocking access to all post/tag URIs via htaccess
- Site in subfolder – all pages work except home
- External content won’t load in iframe in Safari
- How to write .htaccess so that https is on for subpages only but not the home page
- How to create a redirect in the .htaccess file, with 2 exceptions
- 404 error Additionally 403 Forbidden error on a URL
- Custom rewrite rule, url returning 404
- mod_rewrite doesn’t work as I want even with JSON API Plugin disabled
- Disable directory browsing of uploads folder
- Creating a copy of a website in a subdirectory, wp-admin redirect problem
- disable WordPress 404 for one specific page/folder to receive actual php errors
- .htaccess Non-‘www’ to ‘www’ Subdomain Redirection Only Works for Homepage
- Access sub-domain when root public_html is protected with .htaccess password
- Cannot access subdirectory subpages
- How to execute WordPress as though it is in the root folder while it is installed in a subdirectory?
- How can I create a smarter .htaccess file that will add a directory?
- WP Codex answer incomplete? Put WP in subdirectory. .htaccess change required
- Rewriting subfolders to specific parent folder in WordPress
- Redirect WordPress site to a landing (construction) page using htaccess, with access to /wp-admin and /invoice
- htaccess redirect to path
- Install second wordpress in root subfolder, Error 404
- Remove subdirectory from links
- How to properly give WordPress its own directory
- htaccess- to hide subdirectory slug only from the post
- How to direct users to a subcatalog
- Installing wordpress on subdirectory 2 levels down
- Cannot Override WordPress 404 for a Sub-Directory
- I can access subdirectory, but not files within it
- .htaccess and virtual host configuration for WP in its own directory
- Giving WordPress it’s own directory and using .htaccess Directory Index
- Add-on domain works in WordPress but links still lead to subdomain
- Are there any negative impact if access to directories were accidently denied?
- How to remove .html from URL?
- How to remove .html from URL?
- How can I use an .htaccess file in Nginx?
- .htaccess – how to force “www.” in a generic way?
- htaccess – Redirect to subfolder without changing browser URL
- .htaccess Remove WWW from URL + Directories
- How does RewriteBase work in .htaccess
- Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
- Generic htaccess redirect www to non-www
- Best collection of code for your .htaccess file [closed]
- Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error
- Moving a WP Multisite to a subdirectory
- Default .htaccess file for WordPress?
- Which one does WordPress prioritize when it comes to php.ini, wp-config and .htaccess?
- Masking wp-content/themes/name/images to just images directory using htaccess
- Improve wordpress security by hiding non public resources
- WordPress site hacked. Has .htaccess been hacked?
- Does this .htaccess security setting really work?
- htaccess problem after saving Settings
- Stop WordPress and Plugins from Overwriting .htaccess
- Move WordPress to subdirectory, keep ALL URLs
- htaccess disable WordPress rewrite rules for folder and its contents
- htaccess rewrite conflict with wordpress rules and ssl
- Non-WordPress page in subdirectory under WordPress page
- htaccess https redirect from www to non-www
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- Htaccess for Wordpess set on single subdomain
- adding rewrite rules in .htaccess
- .htaccess and 500 error, extra character added
- WordPress .htaccess subdirectory problem
- Name-based virtual host configuration in Apache seems to cause a “500 Internal Server Error”
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Site redirects to wrong url when saving settings
- Static raw HTML page
- WordPress + Magento .htaccess ReWriteRule Issue (www vs. non-www)
- Plugin to edit htaccess file
- Why “Settings->Permalinks” creates .htaccess file on nginx server?
- .htaccess file redirecting to parent directory
- WordPress in sub directory wp-admin problem
- How to map permalinks with accented letters to sanitized slugs?