The custom rule you are trying doesn’t meet the criteria. Here’s a nifty online .htaccess
tester tool to see to check rewrite logic.
Use the follow RewriteRule
instead:
RewriteCond %{QUERY_STRING} (^|&)name=(.*)
RewriteRule ^(.*)$ /profile/%2/? [R=301,L]
Be sure to replace ^example\.com$
on the first line with your actual domain.
You can also embed it in the <IfModule mod_rewrite.c>
tag that was created by WordPress, which should look like the following as the end result:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# BEGIN Custom Rules
RewriteCond %{QUERY_STRING} (^|&)name=(.*)
RewriteRule ^(.*)$ /profile/%2/? [R=301,L]
</IfModule>
# END Custom Rules
# END WordPress
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?
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- removed index.php now all pages 404
- Rewrite rule never matching
- Redirect old permalinks with Month and name to Post name on new site
- Rewrite-Rules not working on a vhost, everything goes to index.php
- 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?
- Why specific file directory fails to redirect but its parent folder succeeds?
- After moving from subdirectory to home, home page does not display
- Specific URL Rewriting with parameters in wordpress
- Problems redirecting to “pretty” permalinks (wordpress in Subdirectory)
- Permalinks: Page Not Found
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- Redirect parent taxonomy to it’s child
- AWS WordPress Install – pages/posts 404 on restart until updating permalinks
- WordPress 404 in development area
- Need Help Correct Regular Expression Redirect Code
- Changing the post date without causing 404 error
- How do I add /blog/ as a prefix to permalink structure for posts, categories & tags?
- Page preview is shown, updating page gives 404 error
- Redirect Uploads Folder to Query Vars in WordPress
- Redirect a Blogger Page URL to wordpress
- Redirecting all posts after changing URL structure with htaccess
- Redirect all posts permalinks from “.html” to “/”
- WordPress 4.4 old permalink redirect
- Htaccess https 301 problem
- Accessing Subdirectories in WordPress Install
- How to use different domains for different blogs hosted in the same host in subdomains with .htaccess
- Resolve 404 on posts without category
- 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
- permalink and add_rewrite_rule – error 404
- old permalinks not found
- corrupted URLs – can’t leave starting page
- remove SLASH on single_post but KEEP on categories and parent pages
- .htaccess to redirect to a wp page
- Extending page urls without getting a 404
- No Ones Been Able to Override my WordPress Rewrite Rule Issue!
- LetsEncrypt WordPress on the Raspberry Pi – Nice url’s give 404 with https, http works
- Can’t access WordPress site in subfolder possibly because of .htaccess redirect from root installation?
- When using number in url it is redircting to same page but when using character it redirects to 404
- Folder Name and Category Name WordPress
- WordPress permalink still not working (error or not understood?)
- Only homepage working correctly, 404 error on everything else
- 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
- Standard Htaccess directives disappear by themselves
- Need help with add_rewrite_rule
- After server migration only the homepage works
- remove “index.php” from permalinks
- Changing permalinks gives me 404 errors on nginx
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- How does WordPress handle permalinks?
- Rewrite Rule for Multilingual Website, Like qTranslate?
- Custom post type permalink endpoint
- Setting up WordPress with Custom Permalinks and no .htaccess File?
- Does WordPress Change the .htaccess File When Updating?
- Removing the redirect after changing a page’s slug
- Setting 404 page in Nginx
- Custom post type 404s with rewriting even after resetting permalinks
- Including category-base in a post permalink results in 404
- WordPress thinks my custom route is a 404
- Move WordPress to subdirectory, keep ALL URLs
- permalink independent on the post’s name stored in the database
- Regex in add_rewrite_tag not accepting OR operators?
- How to add a custom URL placeholder to author archives?
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- Permalinks to Custom does not work (out of box)
- URL rewrite based on a custom field value
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- How can I force WordPress to redirect to canonical permalinks?
- Subdomains to pages
- Redirect old permalinks to new permalinks
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- Permalink/Pagination issue: Category base name same as page name
- + Character in permalink
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Make post slug have priority over category slug
- How can I include a query string with get_permalink
- Permalink redirection from ‘Day and name’ to ‘Post name’
- How to map permalinks with accented letters to sanitized slugs?
- Homepage loads but all permalinks are 404 when using nginx & PHP-FPM
- Remove subfolders from URL
- Nicest way to 301 Redirect traffic when changing permalink settings