Web Design and Development
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:
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.
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 URL Redirection, which only enables one url per page.
To turn off Canonical URL Redirection, you can add the following code to your theme’s functions.php file.
remove_filter('template_redirect','redirect_canonical');
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.
Tags: redirects, search engine submission, urls, WordPressWanna run a Wordpress Network on multiple ports? | WebXL Consulting LLC
Trackback URL for this entry:
http://www.velvetblues.com/web-development-blog/turn-off-wordpress-homepage-url-redirection/trackback/
Contact us today for a quote. Click here to submit details regarding your project.
If you are making a general inquiry, send an email to info@velvetblues.com
I hadn’t looked into it but i was wondering if this can be done at all. Although you have to be very careful when doing it since duplicate content is not generally a good idea. Nice to see you back
I still prefer Index.html method to be the best and handy
Hey welcome back. Where have you been?
Thanks for this little tip on WP URL redirection
Thank you… Didn’t even know there was a plugin yet… Love the idea of not needing to alter existing php
I agree, I don’t like altering .php files. I have done it but I’m never quite sure I’m not screwing something up in the process. Come to think of it, it caused me to delete and reload themes a few times. Thanks for the tip on the plugin. It will come in handy.
Anyone home?
hi frien. how do you think about the pretty link. Its a redirection used to create redirection. are you think it will droped our web from search engine?
Thank you for this. One Google search and I got my answer!
You can also use the All-In-One SEO plug-in which turns this function without editing the PHP yourself. I’m a big supporter, fan and friend of Mark Jaquith’s work, but this plug-in provides a lot more features as well if you’re going to install a plug-in.
I guess I prefer the ‘extra work’ method. I use a sub-domain and match the headers to function site wide. Turning off the canonical URL redirection seems dangerous but I can see why some would go that route.
I know I sound like a numpty but were do I put the plugin file?! I’ve downloaded ‘disable-canonical-redirects.php’ but don’t know were to upload it now?
One main reason to turn this off in WP is for a very simple fact… and it relates to SEO; and take it from me, I have a been a full-time web developer for 12 years. The way WP wrote the redirect is bad. If you submit your site to Google, or it just finds it as www.yourdomain.com, and the WP redirect is set to yourdomain.com – Google will see a 301 message for www, but instead of following it, the bot will stop dead. So the bot never actually indexes any of your content! Yahoo.com bot does the same. So, you can either worry about the negligible issue of having duplicate content indexed, or settle with no content index at all… I choose multiple content.
Very useful tutorial and I didn’t know that wordpress has a automatic redirection system. It could also cause the duplicate content issue within a site.
Just found out that if you are using redirect plugin you need to go to redirection > groups > and remove the latest redirection as automatically setup.
Wordpress 3.0 seems to stuff this up with the redirection plugin.
is it possible to rename index.php?
i face this problem for some time. but still can’t get any answer on the internet.
I have problem with cononical url, i was disabled the canonical url, and setting my .htaccess to redirect my blog from without www to using www, after that i can’t login to my admin page, my password was wrong..
if i using without www i can login. any solution ?
thanks
I tried the solutions mentioned here on my WP 3.0.4 install. They did not help. What did was temporarily commenting out this line on \wp-includes\canonical.php –
add_action(‘template_redirect’, ‘redirect_canonical’);
I will comment it back in when the site is ready to go.
Finding this article two months back would have saved me loads of time…
I installed a new wordpress site and had big problems because I had put in a single HTML site for the first time in conjunction with the wordpress installation. It always redirected from sites to other sites with no apparant reason and I had no idea how to fix it x_x
Now I’ll know where to look at if I should run into that again. Thanks.
i tried what renee did and it works fine for the index.php page, however, when i click on the dummy ‘about’ page in the default template, it jumps back to the live index.html page – am i missing something obvious? thanks
hi again
fixed!!! mayur told me to change the permalink setting to month/date and it’s working now
@Webvet.
Sure it may be simpler to have multiple content, but it really does hurt your SEO.
I wasn’t aware of the 301 problem, so should investigate. But could this be sorted out by setting the preferred domain in webmaster tools?
After 3 hours of work and searching for a solution that would solve my redirect problem, I have finally fount this website and I would like to thank tha author thousend times for this post.
I set up a new installation of WordPress in my addon domain’s root directory. I’ve created the webiste and everything. When I type in the url of my website, for example: http://example.com the site goes to a “Not Found” page, but my site is showing and if I click the “home” tab on the site, it shows my homepage correctly. Why isn’t my correct homepage showing when I type in my URL? Can someone please help me.