Using Apache
I’d go with an .htaccess
rule
RewriteRule ^test/(.*) http://www.example.com/demo/$1 [R=301,L]
so http://www.example.com/test/page
would now go to http://www.example.com/demo/page
and the 301 redirect would make it permanent
make sure you put your rewrite rule after these rules
RewriteEngine on
RewriteBase /
Using Nginx
in the server block
server {
. . .
rewrite ^/test/(.*) http://www.example.com/demo/$1 permanent;
. . .
}
Related Posts:
- When I change slug, will WordPress create redirect from the old URL?
- Why is WordPress redirecting from http to https on a local environment?
- Why am I getting a 301 on a existing post?
- Non-WordPress page in subdirectory under WordPress page
- Keeps on redirecting on my development copy
- Password change when the user login first time
- Custom login form redirect to external site
- Clarification on auth_redirect()
- Exclude a path from WordPress using .htaccess redirects (Apache)
- Restrict Access to wp-login.php
- Redirect to custom URL after registering from a page with registration form
- Stop unwanted WP redirection to new url
- Problem to redirect custom page using htaccess
- WordPress within a subdirectory of another WordPress environment doesn’t work
- wp-login.php — redirect logged in users to custom URL
- Website redirecting to old domain name
- How to do 301 redirect to Sub page using htaccess file?
- Redirect feed to 404 page
- Does WordPress automatically redirect url without parent slug?
- Redirect guest if he tries to access a specific page
- htaccess 301 redirect http to https doesn’t work
- Site redirecting from http to https [closed]
- Localhost wordpress site redirects to public site
- Use htaccess to redirect WordPress to static website in a subfolder
- Defining a custom 404 for non-WordPress parts of site
- Redirect homepage ( www.sitename.com ) to the latest post
- Redirect all post into some category to url without category
- How to redirect URL with subfolder to the same URL but without subfolder?
- What is the right way to redirect all traffic to HTTPS?
- If User is NOT Logged in and Page ID is not 6 – Redirect to Login
- Where’s the redirect happening? [closed]
- Snippet for own (gr)avatars
- Front end user creation form! How do you keep the user on the same page in event of error?
- URL redirect problem
- How to redirect if a background request is still being executed
- WP site in infinite redirect loop
- Regex with HttAccess
- WordPress keeps redirecting subpages without http to https homepage after switch
- Redirect non-existent subpages to second part of url
- https – too many redirects
- How to remove the [L] Flag for WordPress index .php mod_rewrite
- ReDirect subfolder link to another sub-folder and force SSL
- How do I remove the RSS Feed Redirect?
- Why does WordPress redirect when I separate wp-core and wp-content?
- Redirect user to original url after login?
- User redirect to specific URL after logging in
- What is the most efficient (ie. less server intensive) way for 301 redirects?
- Redirect user if they are not logged in
- BuddyPress – Redirects on Login and Logout
- Logout without confirmation and SAME window on mobile
- Redirect to page for KPI/marketing purpouses
- adding GET variables to a header() location in a page template
- Parked domain redirect
- WordPress CSS/Theme gone after SSL got activated
- Redirect 301 of old urls to wordpress urls
- How can I redirect a request to the site root using htaccess, if there’s not a specific cookie set?
- Redirect one domain to another
- Only execute function if SSL is set up properly
- Redirect User to login page
- How to redirect user after login to the page called by his first name?
- Redirect After Login Error
- Redirect after get_delete_post_link
- Is it possible to detect if a POST action is for a “Save Post” before the save_post action?
- Login redirect to previous page
- Disable and Hide WP-JSON
- URL redirection
- Redirect when not logged and parametr in link
- Browsers Forcing Multisite to https
- Is it possible to change redirect template through a shortcode?
- How do redirect user back to previous page when on certain pages?
- Hide a Post everywhere except on redirect
- Keep the old referrer after failed login
- How to 301 redirect WP posts id “/c/94940894” to permalink with post name?
- WP 301 redirect does not work
- URL redirect regular expressions redirecting all after first viriable
- 301 Redirect Link to Media
- WordPress Redirect post to outside website based on useragent
- How to create mass 301 redirects with PHP in Nginx server without using a WP plugin
- HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page? [closed]
- WordPress redirects to backend when i’am not logged in
- Redirect to custom admin menu after plugin activation
- Redirect HTTP request to HTTPS request
- home page redirect loop after update to 4.8
- Woocommerce login to specific page or referrer
- 301 Redirects when change URL in WordPress database
- How can I redirect to another page with screen already at the bottom of the page?
- How is this URL being redirected?
- What’s the best way to redirect to a new wordpress website?
- 301 Redirect only for posts
- How to move a https website back to dev and access the admin?
- Why is WordPress redirecting to homepage after GET form submit?
- Redirect after user changes password
- Custom Form Redirects to Post after Submit
- URL is redirecting (301) when query string is passed through URL
- Plugin html-on-pages: URL not redirecting
- Hide page for user logged and redirect for profile? [duplicate]
- Redirect URL while building site
- Redirect ignore last URL segment
- Creating custom link that redirects to a another link
- Other pages fine but wp-admin showing ERR_TOO_MANY_REDIRECTS Error