You can define these in your wp-config.php
file:
define('WP_HOME', 'http://'.$_SERVER["SERVER_NAME"]); // blog url
define('WP_SITEURL', 'http://'.$_SERVER["SERVER_NAME"]); // site url
Now, you’ll need to make sure nginx is populating SERVER_NAME appropriately (I’ve had setups that were wrong and kept returning “_”).
This will prevent wordpress form redirecting because it thinks it’s already on the correct domain, and will also affect most generated local permalinks as well.
If that doesn’t work (I only used it on one setup and it’s only relevant to accessing the backend), you can add hooks to the 'option_siteurl'
and 'option_home'
filters to achieve the same affect.
Related Posts:
- Redirect Restricted Page to 404
- Redirect user to original url after login?
- Redirect to dashboard after login
- Make a video post redirect to next post after completion
- Site redirects to wrong url when saving settings
- Redirect blog page to latest post?
- WordPress site redirects to different wordpress domain on the same server after reuploading db backup
- WordPress Redirect based on the prescence of a cookie
- Links to an exisiting Page are now redirecting to a draft page?
- Random and Erroneous WordPress Redirect
- Redirect Old domain & posts to new domain homepage
- Redirecting users to referrer page after logging in using custom login form
- add_rewrite_rule to pass entire path as a single parameter
- What is the wordpress way of displaying local external content?
- RedirectMatch and Redirect interfering with each other
- Return to where the user was, after log out
- Change ‘Back To Website’ link in wp-login.php
- How do I map a subdomain in wordpress to the primary domain in a multisite setup?
- Redirect the non-www version of the site to the www
- htaccess rules not applied?
- Load time cost of using a redirect plugin v direct .htaccess entry
- Intercept the “lost password” action by first redirecting to an existing instructions page
- How to pass email values from one php page to another
- How to redirect after login getting a variable from url (for example with the language)
- How to set 301 redirection after moving WordPress blog?
- How to include error message on login
- How to use a custom domain?
- WooCommerce unexpected behavior [closed]
- Force WordPress to load from site’s hostname
- 301 redirection editing .htaccess doesn’t work
- Redirect custom post type from one domain to another domain
- How can I force the user to log in, even if they’re already authenticated?
- 301 redirect instead of 404 when URL is a prefix of a post or page name?
- Redirect users after register (first login) and force submit post
- Stop Redirecting to and from www
- How to pass a message using template_redirect
- .htaccess 301 redirect conflict with plugin “WordPress Https”
- Disable WordPress URL auto complete
- How do I put up a splash page and have all WordPress links redirect to this page?
- W3 Cache redirects to front page when I press purge all caches
- Stop forcing certain paths to end with a forward slash
- Is it possible to wp_redirect() to a new tab?
- Redirection on Custom page
- How do I redirect users after submitting a topic for moderation?
- Direct iPhone visitors to different stylesheet?
- How to delete a post and keep its slug to refer to another post
- 301 redirect any RSS feed on level up url
- Dynamic 404 page content while still keeping 404 status code?
- Redirect loop with similar URLs
- Why does WP HTTP API switch the method (POST/PURGE) to GET when redirecting (302)?
- Redirect user to specific link after login
- 301 redirect via htaccess rules on the new site
- WordPress Domain redirects to different host
- Change the domain url?
- After retrive password, redirect to index page
- Change Category Slug Redirection
- custom login form redirect problem
- wp_redirect is only working in Chrome Network, page is not redirecting
- Bulk redirect all post
- Disable redirect to homepage after successful Login, Stay on Current Page
- WordPress no permission redirection to a popup
- Open wordpress page in directory the way index.html would open
- How force WordPress redirect to current custom page after login
- How to remove redirection
- Redirect Homepage to another page when user login
- Site using static homepage, redirects (301) and removes pluses from query string
- Determine user destination on wp-login.php
- 301 Redirect in WordPress not working in htaccess
- Disable WordPress URL auto Redirect
- Toggle Redirect Function On/Off With Checkbox
- My wordpress site has “https://” on it but when I go to Dashboard and click visit site, it removes the “https://”
- After disabling Multisite, homepage redirects to non-existing page
- redirect to https://my-site/wp-admin/ instead of https://my-site/wordpress/wp-admin/ after options updating
- Redirect after login when WordPress in subdirectory
- I get “too many redirects” problem when migrating localhost site
- Internal redirect from page to category
- All links redirecting to homepage
- How to redirect non-admin/editors from specific pages?
- How to make a redirect link in wordpress?
- wp_redirect leading to an infinite loop
- Redirect after Permalink change – What regex do I use?
- I’ve move my site but URL still goes to the old site
- WordPress update 4.4.1 redirect loop
- Redirecting Issue
- Redirect user to login and then to page where they came from
- htaccess and redirect to new url using regex
- redirect attachment page to category page
- 301 redirect for wordpress permarlink
- Google PageSpeed: Avoid landing page redirects?
- login_redirect for Mobile Web
- How to make my homepage automatically redirect to an external website?
- Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?
- How to Redirect Url to homepage?
- 404 Not Found with All Cloaking plugins
- Stopping media file redirects
- How to redirect users without permission to view content to a custom page?
- redirect the root of a domain, while leaving the www version unredirected
- How to Create Custom Route to a page in WordPress
- How to create a redirect to another domain like safe redirect manager from php
- Post Migration Site Migration Redirects All Known Solutions Attempted