WAY #1 – cPanel
I assume your host is using cPanel managing your Server.
Browse domainname.com/cpanel
, login their with cPanel credential:
Change the values according the following image:
Don’t forget to check the “Wildcard Redirect” to redirect all the subfolder/subpages also (Thanks to @RobertHue). Add the redirection and you are done.
WAY #2 – .htaccess
Open up your .htaccess
of domainname.com/blog/
in edit mode. Put the following code there (I made it using WebConfs.com Redirect Generator):
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://newdomainname.com/$1 [R=301,L]
Save it. And yala!
EDIT
That’s well said by @RobertHue. I did not mention the subfolder or subpages redirection. So I edited my answer, changed the attached images and posted new code. Thanks a lot @RobertHue for pointing the important things.
Related Posts:
- Redirect custom post type from one domain to another domain
- htaccess 301 Redirect not working for WordPress site
- Built-In Postname Redirection vs Hard Redirects in relation to SEO and performance
- How to remove the [L] Flag for WordPress index .php mod_rewrite
- How do I write a subdomain redirect?
- Date based redirects of posts that no longer exist
- 301 Redirect in WordPress not working in htaccess
- Resolving the too many redirects on wordpress
- Other pages fine but wp-admin showing ERR_TOO_MANY_REDIRECTS Error
- Safely redirect old WordPress blog links to new WP blog
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- wp_redirect() function is not working
- Redirect entire website to a single page
- Redirect page URL to home URL without using a plugin
- Why is wp_redirect() preferable to a standard PHP header redirect?
- WordPress HTTPS redirect loop
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- Non-WordPress page in subdirectory under WordPress page
- Force HTTPS using .htaccess – stuck in redirect loop
- PHP – redirect https to http and www to non-www
- How do I turn off 301 redirecting posts (not canonical)?
- Password change when the user login first time
- Redirecting WordPress /.htaccess / HSTS / SSL
- 301 redirect not working through .htaccess
- Site redirects to wrong url when saving settings
- How to redirect url requests to https? [closed]
- Htaccess redirect from ‘/%postname%.html’ to ‘/%postname%’
- How can I move/redirect single blog posts from one blog to another?
- Redirecting old permalink to new one
- Index in root, wordpress in subdirectory
- Redirect www to non-www htaccess
- 302 redirect instead of 301 after switch to HTTPS
- Specific URL has 403 Forbidden status code
- How do I skip wordpress’s 404 handling?
- Stop unwanted WP redirection to new url
- Custom domain for sub-section of parent website
- Problem to redirect custom page using htaccess
- wp-login.php — redirect logged in users to custom URL
- Redirect to “All Posts” after post update or publish in Block Editor
- htaccess redirect not working
- Redirect user after login/registration globally
- htaccess wildcard redirect misses some URLs
- Redirecting old site links to new site
- Redirect to login page
- Temporary redirect prevents getting $_POST array
- Redirect from https to http or from http to https? [closed]
- Creating intro page in wordpress
- URL Redirect and Bulk Actions in wp_list_table
- Redirect too many times htacces switching to https
- Redirect to https not working with .htaccess [closed]
- How to do 301 redirect to Sub page using htaccess file?
- How to redirect only if page doesn’t exists
- Headers already sent – WordPress core
- htaccess redirect – directory and subpages to a single page
- Perform a redirect after user action
- WWW to non WWW redirect effects on load speed
- How To Only Allow Users To View Their Own Buddypress Profiles? [closed]
- Can WordPress redirect to a “similar page” in case of 404 error
- htaccess redirect dynamic posts
- Hacked website redirect, only on desktop, help with restoring it [closed]
- RedirectMatch and Redirect interfering with each other
- How to hide that a certain non-WordPress directory exists on the server?
- Menu links only using http after enabling https, unable to redirect http links
- Redirect “any page/page/number/” to “any page”
- Why specific file directory fails to redirect but its parent folder succeeds?
- WordPress site in subdirectory load site in main directory
- https multiple redirects
- How to create a 301 redirect that doesn’t apply to subsites
- Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?
- WordPress multisite htaccess redirection to new domain
- some url does not redirect from http to https
- Why can’t I access files / directories outside of wordpress
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- Redirect blogpage /blog/abcd/ to /blog/
- https redirect (with .htaccess) redirect loop
- How to redirect from various ?page_id= to home page?
- How to auto login after registration? [duplicate]
- Deny access to a path (give 403 or 404 response)
- header and wp_redirect not working. cannot modify header information warning
- htaccess 301 redirect http to https doesn’t work
- Code to create a redirection after login?
- Redirect home to another page with htaccess
- Redirect all pages except one to homepage via .htaccess
- How do I redirect /search/ to ?s=
- 301 Redirect Loop
- Redirect 301 www.my-site.com/page/n to www.my-site.com/ [closed]
- Does WP always makes 301 redirection?
- Redirecting old post url to 404 in wordpress using htaccess
- Headless WordPress redirect front-page to login page [closed]
- How to redirect subcategories to a page?
- WordPress Global Redirect
- Use htaccess to redirect WordPress to static website in a subfolder
- Why does wp_redirect strip out %0A (url encoded new line character) and how do I make it stop?
- htaccess redirects and WordPress
- How to redirect to home page after registration?
- Redirect blog archive into certain format
- 301 Redirect To Post ID
- CNAME vs A Record for WWW – with 301 Redirects
- How to publish new posts/pages in root instead of subfolder, but keep old structure in place?