Jak usunąć automatyczne przekierowania w wordpress

Artykuł pochodzi z:
http://www.mydigitallife.info/how-to-disable-wordpress-canonical-url-or-permalink-auto-redirect/

Internet
Jan 24, 2010
My Digital Life Editorial Team
6 Comments
Delicious Delicious
digg
How to Disable WordPress Canonical URL or Permalink Auto Redirect

Since WordPress 2.3, the popular blog publishing system has included a feature which will automatically redirect incorrect, incomplete, improperly formatted, or unofficial versions of URLs, hyperlinks or permalinks to canonical URLs, which is the authoritative and officially correct or final version of URL for a particular web page served and generated by WordPress.

Due to the nature of WordPress, where most bloggers use .htaccess mod_rewrite module for fancy permalinks, multiple versions of URLs can be used to access the same content page, such as directly through ?paged=id query string, URL been appended with index.php or other alternative fancy and SEO-friendly URL. In addition, WordPress will always append trailing slash to the URL if the link omits or without trailing slash, and redirect domain name which does not starts with www (e.g. mydigitallife.info) to one with www prefix (e.g. http://www.mydigitallife.info).

As explained by Mark Jaquith, the WordPress developer, multiple URLs showing the exact same content may cause duplicate content issue or penalty with search engines, as all of these alternative URLs, which represent the same resource may not be condensed into a single resource by search engine. As a result, the duplicate URLs can actually end up competing against each other in search engine rankings.

However, some bloggers may not want the WordPress built-in canonical URL automatic redirection feature. This is especially true for people who makes use of advanced SEO plugin which already provides comprehensive canonical link redirect, where the built-in WordPress canonical link feature may cause conflict, and even infinite redirect loop that makes web browser unable to open the web pages.

It’s possible to turn off and disable the WordPress canonical URL redirection, with a simple code. To stop the WordPress redirects non-standard URL to canonical URL, just add the following code to the active theme’s functions.php file, located under /wp-content/themes/theme-name/ directory.

remove_filter(‚template_redirect’, ‚redirect_canonical’);

It’s also possible to implement the code above via plugin to prevent the redirection to standard WordPress link location. Mark Jaquith has created Disable Canonical URL Redirection plugin. Just copy and paste the below code to a text editor, and save the file as disable-canonical-redirects.php. Then, upload the PHP file to plugins directory, and activate it.

Or, just download the disable-canonical-redirects.php.

Advertisements

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Log Out / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s