Try something like the following at the top of your .htaccess
file at sample.com
:
RewriteEngine On
RewriteRule ^code/. https://www.someotherdomain.com%{REQUEST_URI} [R,L]
Related Posts:
- How to set 301 redirection after moving WordPress blog?
- 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
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- wp_redirect() function is not working
- 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
- 301 redirect not working through .htaccess
- How to redirect url requests to https? [closed]
- How can I move/redirect single blog posts from one blog to another?
- 302 redirect instead of 301 after switch to HTTPS
- How do I skip wordpress’s 404 handling?
- wp-login.php — redirect logged in users to custom URL
- Temporary redirect prevents getting $_POST array
- Redirect from https to http or from http to https? [closed]
- URL Redirect and Bulk Actions in wp_list_table
- Redirect too many times htacces switching to https
- Can WordPress redirect to a “similar page” in case of 404 error
- Hacked website redirect, only on desktop, help with restoring it [closed]
- How to hide that a certain non-WordPress directory exists on the server?
- Redirect “any page/page/number/” to “any page”
- How to create a 301 redirect that doesn’t apply to subsites
- WordPress multisite htaccess redirection to new domain
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- https redirect (with .htaccess) redirect loop
- How to auto login after registration? [duplicate]
- Redirecting old post url to 404 in wordpress using htaccess
- How to redirect subcategories to a page?
- How to redirect to home page after registration?
- Redirect blog archive into certain format
- 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?
- forward domain name to particular page?
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- Redirect from sub-directory to root – New WordPress 5.2.3 Set up
- Stuck In a Redirect Loop
- What is the right way to redirect all traffic to HTTPS?
- Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite
- Site loads very slowly (4-5 minute load time)
- Adding rewrite rule dynamically for search results redirecting to 404 URL
- WordPress category page redirects in .htaccess not working
- I need to redirect an entire subdirectory in WordPress to the homepage – is this correct?
- 503 Service Unavailable error was encountered
- Redirecting old permalink structure to new in htaccess
- WordPress keeps redirecting subpages without http to https homepage after switch
- Redirect “http://old.net/category/postname” to “https://new.com/postname”?
- ReDirect subfolder link to another sub-folder and force SSL
- What is the most efficient (ie. less server intensive) way for 301 redirects?
- How to forward all requests starting with a specific folder name to the same folder
- How do I do a redirect to WordPress permalink with post id via htaccess?
- store URL global before we redirect
- Issue redirecting ‘blog’ to ‘news’ in WordPress using .htaccess
- Some Pemalink problems, probably caused by wrong .htaccess configuration?
- Will deleting WP’s code in .htaccess cause problems?
- Use two different index pages
- How to redirect from one WP site to another
- How can I redirect a request to the site root using htaccess, if there’s not a specific cookie set?
- How to fix automatic redirects?
- Redirect old query string URLs to new add_rewrite_rule URL
- Is there way to redirect all blog post pages to Home page?
- get_bloginfo prints IP instead of url
- How to redirect multiple subfolders back to root domain?
- How to redirect non existent pages/posts in wordpress using htaccess
- How do I Redirect Tags from Old Joomla Site to New WordPress Site?
- Temporary Infinite Redirect Loop
- A question about .htaccess
- How to redirect a child page to its parent page?
- WordPress multi domain: page redirect to main domain whenever WordPress do the URL guessing issue
- Applying ‘middleware’ to a url before redirecting? Does WP have built in mechanism for this?
- How do redirect user back to previous page when on certain pages?
- ErrorDocument 410 gives me back a 302 header
- ERR_TOO_MANY_REDIRECTS when switching from good database to old database
- Redirect to /404/
- Erase the HTML website and replace it with a WordPress website -301 Redirection
- WordPress not linking correctly with .htaccess redirect to subdirectory
- How to create multiple Rewrite-Rule for various site in single htaccess?
- WordPress site not forcing from http to https instead getting redirected too many times
- Redirect only PDFs in different folders?
- using wp_rewrite but keep the original url in the address bar
- How do I skip wordpress’s 404 handling?
- home page redirect loop after update to 4.8
- Cannot get 301 redirection in htaccess to work (either Redirect or Rewrite)
- How to redirect 404s that generated for css&JS files?
- What’s the best way to redirect to a new wordpress website?
- .htaccess not working after page slug change
- Debugging a redirect loop affecting only certain pages
- WordPress on a subfolder but accessible from root
- WordPress redirect from one directory to another but exclude wp-admin and wp-login.php
- Can I redirect the http request towards an old folder to the homepage using .htaccess file? [closed]
- wp_redirect() doesn’t work
- Redirect old homepage to the new one within the same site