This can not work in the way you want. If wordpress is on example.com then all the auto generated links will point to example.com even for pages that are on the CDN under the www.example.com domain. This will result that after the first page being served from the CDN many other pages will be served directly from wordpress.
-
from inspecting the code, the code that does it is deep inside
redirect_canonical
so either you need to write your own redicrection and do something likeremove_action(“template_redirect”, “redirect_canonical”);
add_action(‘template_redirect’, ‘wpsr12150_redirect_canonical’);
function wpsr12150_redirect_canonical() {
// code without the www redirection
}
but it is probably easier to handle it in an .htaccess file, for example make it always remove the www from incoming requests
- yes!
Related Posts:
- WP redirects all pages from new domain to old domain
- How to prevent automatic redirection of 404 errors and “incorrect” URLs?
- Disable WordPress URL auto complete
- Redirect user to original url after login?
- Disable ONLY URL auto complete, not the whole canonical URL system
- User redirect to destination URL after login
- Redirecting WordPress /.htaccess / HSTS / SSL
- Site redirects to wrong url when saving settings
- Why does WordPress automatically redirect URLs with the parameter “name=” to a different page?
- How to setup 301 redirects for multiple query string URLs?
- Login to wp-admin “redirect_to” points to wrong URL after migration
- Stop unwanted WP redirection to new url
- How does WordPress redirect to WooCommerce shop page? [closed]
- Does WordPress automatically redirect url without parent slug?
- How to redirect visitor to a custom URL using PHP code in functions.php
- Redirect home to another page with htaccess
- Why does wp_redirect strip out %0A (url encoded new line character) and how do I make it stop?
- How to redirect URL with subfolder to the same URL but without subfolder?
- How to redirect a page into file?
- How to redirect after login getting a variable from url (for example with the language)
- How can I replace my primary url globally with a parked one?
- How to use a custom domain?
- Changing siteurl and homeurl – internal links redirect to home page?
- URL redirect problem
- Adding rewrite rule dynamically for search results redirecting to 404 URL
- Force WordPress to load from site’s hostname
- How to redirect to clean links with this code
- Can’t control WordPress Addresses from admin panel
- reducing number of URL Redirects and increasing speed
- URL masking of subdomain to main domain using .htaccess
- Disable WordPress URL auto complete
- Redirect user to original url after login?
- Permalinks settings
- Redirect non existing page to frontpage
- store URL global before we redirect
- How to redirect the frontend of a WordPress site (only)?
- WP_List_table with form of method=GET redirects to wrong url after submit
- Redirect old URL (with different post ID) to new URL
- How to fix automatic redirects?
- My redirect URL doesn’t show any pages on my website [closed]
- Site Address and WordPress Address settings when using a load balancer
- URL redirection
- URL redirect regular expressions redirecting all after first viriable
- Disable WordPress URL auto Redirect
- How to get user details by name
- Redirect only PDFs in different folders?
- How to disable WordPress URL autocomplete / recognition?
- change home_url and site_url but don’t redirect to home_url and site_url on load
- using wp_rewrite but keep the original url in the address bar
- I’ve move my site but URL still goes to the old site
- Redirect based on $_GET parameters
- International characters in slugs to redirect to
- Displays url’s twice and getting 404 errors after activating
- Rewrite rule for incoming urls
- URL Custom Rewrite
- How to handle expired assets/content when user has direct URL
- How to change Ugly link?
- Redirect ignore last URL segment
- How to change the default location where new post gets stored?
- My Pages Have Been Redirected Automatically in WordPress. How to Stop It?
- PHP header(Location: …): Force URL change in address bar
- What does HTTP/1.1 302 mean exactly?
- php refresh current page?
- What’s the difference between home_url() and site_url()
- How to force a 404 on WordPress
- Disable front end to use as CMS only?
- Redirect Restricted Page to 404
- How to redirect non-logged in users to a specific page?
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- Host the wp-admin on another domain?
- When I change slug, will WordPress create redirect from the old URL?
- WordPress localhost site redirect to live site
- WordPress redirecting connections on port 8080 to 80
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- wp_redirect() function is not working
- Redirect entire website to a single page
- My wordpress multisite homepage redirects to signup page
- Logout redirect to home page
- Redirect Localhost wordpress site to dashboard
- Redirect page URL to home URL without using a plugin
- Why is WordPress redirecting from http to https on a local environment?
- Login redirect to previous page
- How to prevent redirect to ‘About’ after core upgrade?
- Prevent “main” WPMU site_url() being returned in functions
- 301 redirect instead of 404 when URL is a prefix of a post or page name?
- Why is wp_redirect() preferable to a standard PHP header redirect?
- How do I programmatically generate a 404?
- Getting the Site URL Including the Front Base
- Redirect to referring page after logging in
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Prevent access to single post types
- check first time login only
- How to change the default logout link on WordPress Admin
- Stop WordPress from “guessing” redirects for nonexistent URLs
- Changing attachment urls?
- WordPress install enters an infinite loop
- How to redirect a sucessful registration to a page template?
- Creating 301 Redirects for Post, Page, Category and Image URLs?
- How to configure nginx to redirect requests to the uploads directory to the production server?
- WordPress HTTPS redirect loop