If you are integrating WordPress into a preexisting site that already has its own homepage, or if you are developing a new WordPress website that is hidden behind a Coming Soon page, you will run into one frustrating problem. If you try to access the WordPress installation by visiting the index.php file, you won’t be able to see it. Instead, WordPress will automatically redirect you from the index.php page to the blog address url, as defined in your WordPress site settings.
There are, of course, several ways to get around this problem. Two common ways include:
- developing the WordPress site in its own directory
- integrating the preexisting site or coming soon page within the WordPress site
Unfortunately, these methods can result in quite a bit of extra work. Fortunately, it is easy to stop WordPress’ automatic redirects. But first, it is a good idea to know why WordPress employs these redirects.
Why WordPress Has Automatic URL Redirects
A page on any website, WordPress or not, can be accessed by multiple urls. For example, you can typically visit the home page of a WordPress web site by all of the following urls:
The problem with allowing all of these ways to access a single page is that it can potentially hurt your website’s overall search engine optimization (SEO). Having multiple urls for a page means that search engines could index duplicate copies. So WordPress fixes this problem by employing automatic redirects known as Canonical URLRedirection, which only enables one url per page.
How To Turn Off Canonical URL Redirection
To turn off Canonical URL Redirection, you can add the following code to your theme’s functions.php file.
Not comfortable altering your theme files? WP developer Mark Jaquith has placed this code in his Disable Canonical URL Redirection plugin.
To learn more about the introduction of Canonical URLs, see Migrating Plugins and Themes to 2.3 in the WordPress Codex.