国外设计欣赏网站 - DOOOOR.com

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

[Drupal模块] Drupal7、6移除页面路径别名原始路径模块GlobalRedirect

[复制链接]
发表于 1-27-2012 04:21 | 显示全部楼层 |阅读模式
GlobalRedirect是一个简单易懂模块,这个模块在页面拥有路径别名的情况下,移除该页面的原始路径,这样可以减少网站的重复内容页面,有利于SEO优化.8 {7 A' K  o# m3 c8 O4 \. w# ~
9 K0 X! ~0 j6 }% V. Z6 a
下载地址:http://drupal.org/project/globalredirect6 ?0 V. x9 x& b4 G
What?

GlobalRedirect is a simple module which…

  • Checks the current URL for an alias and does a 301 redirect to it if it is not being used.
  • Checks the current URL for a trailing slash, removes it if present and repeats check 1 with the new request.
  • Checks if the current URL is the same as the site_frontpage and redirects to the frontpage if there is a match.
  • Checks if the Clean URLs feature is enabled and then checks the current URL is being accessed using the clean method rather than the 'unclean' method.
  • Checks access to the URL. If the user does not have access to the path, then no redirects are done. This helps avoid exposing private aliased node's.
  • Make sure the case of the URL being accessed is the same as the one set by the author/administrator. For example, if you set the alias "articles/cake-making" to node/123, then the user can access the alias with any combination of case.
  • Most of the above options are configurable in the settings page. In Drupal 5 you can access this after enabling the globalredirect_admin module. In Drupal 6, the settings page is bundled into the module.8 t- {# }' Q/ J! S9 L
Why?

Once enabled, an alias provides a nice clean URL for a path on a site. However Drupal does not remove the old path (eg node/1234). The problem is that you now have two URLs representing the same content. This is dangerous territory for duplicate pages which can get you sandboxed by the search engines!

How?

This module uses hook_init to interrupt the page load and action the alias lookups. If any of the above rules apply then the appropriate action is taken. If no rules apply then the page load continues uninterrupted. An example of this in use is on the site it was developed for.http://www.sportbusiness.com/node/160559 will redirect tohttp://www.sportbusiness.com/news/160559/lagardere-sets-up-sports-division due to the alias setup on this site.

Anything I Should Know?

As with most modules - there are often a few things you should be aware of before going ahead.

  • I recommend using the 6.x-1.4 or 7.x-1.4 release, depending on your Drupal install version.
  • It is important to know that if your site is in maintenance mode then Global Redirect does not function. This is intentional behaviour.
  • Known Bugs:
    • The latest 7.x-1.4 release has known issues with multilingual sites. See #1378690: Update to 7.x-1.4 adds duplicate language prefixes, causing a redirection loop.
    • Issues with Windows IIS Server. There is a known issue with Clean URL's in IIS and there is also a known issue with certain versions of PHP running on IIS where aPermanent Redirect (301) is incorrectly sent as Object Moved (302).
    • Multilingual sites should thoroughly check their site after enabling this module. There have previously been known issues with i18n causing redirect-loops and such. I believe these have been fixed, but please take care.
    • Drupal For Facebook. The main problem with this is similar to i18n. Both modules use Custom URL Rewriting which appears to confuse GlobalRedirect.5 t  {& V* V, ^, O7 i/ `

    $ h& f4 d8 B9 O2 X" f
Project Information
: K, q% v+ J2 d% l, Z' W' m, s
( ?* J) G9 z( Z8 I1 H2 B8 g# ]0 _
- G2 @9 o8 W9 O/ R* c. g3 Q" L
- R- n3 O. a4 U% M

|2011-2026-版权声明|平台(网站)公约|DOOOOR 设计网 ( 吉ICP备2022003869号 )

GMT+8, 2-12-2025 11:18 , Processed in 1.011847 second(s), 570 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表