Global Redirect - A Solution To A Problem You Didn't Know You Had?

(Submitted Sun, 2006-10-08 00:20) |

Nicholas Thompson has just committed a new module called Global Redirect.

Essentially, the module checks to see if a given node url has been assigned an alias, and if so, uses a permanent redirect to that alias. Currently if you are using url aliasing - say through the path_auto module - you are left with the old numberic url ("node/1234") and the new aliased url. You therefore risk being punished by Uncle Google for serving duplicate content.

Submitted by Ephram Zerb (not verified) on Sun, 2006-10-08 04:28.

Definatly going to check that one out. If only there was a solution for the forwad-slash problem.

Submitted by drawk on Sun, 2006-10-08 06:21.

I wonder if extending this module might be a good way to solve that problem.

Do I understand correctly that the logic would need to be:

1) Check if the user is viewing a node
2) If so, check if the url has a trailing slash
3) If it doesn't have a trailing slash, send a 301 redirect to the same url with a trailing slash appended

?

It shouldn't be difficult to add that to the Global Redirect module, if that's all it would take. I'd be happy to write a patch.

Submitted by nicholasThompson (not verified) on Sun, 2006-10-08 13:17.

It could probably easily be modified for that... However we'd need to definately know there are no cases where a trailing forward slash is definately needed...

Submitted by Bob Dannon (not verified) on Sun, 2007-03-04 04:29.

Hi, just popped in here through a random link. Hi, firstly I'd like to say your site is great and very impressive. Enjoyed the reading.

Submitted by drawk on Sun, 2006-10-08 15:20.

Maybe it should be an option that can be enabled/disabled through a settings page, with the default set to disabled.

That way, it can be off except for people that want to test it out. If there appear to be situations where it is causing problems in some setups, one solution might be a textarea on the settings page where site admins can list urls that shouldn't be tampered with ... similar to how block visibility is handled.

Submitted by nicholasThompson (not verified) on Sun, 2006-10-08 16:08.

Possibly - however could this also not be achieved by a nifty piece of Apache redirecting magic (as hyrcan says in his post in the above quoted thread - http://drupal.org/node/83630#comment-154568)

Submitted by drawk on Mon, 2006-10-09 01:05.

I can see the argument for both. The major benefit I'd see from doing it from within Drupal is that - unlike with Apache rewrite rules - you have access to some handy information such as whether the user is viewing a node. The problem that hyrcan ran into re: the login system would be circumvented. As would a whole host of others that would take individual rewrites to deal with, because the information you need just can't be parsed from the url. Plus htaccess modifications are pretty esoteric to a lot of people who are perfectly comfortable installing a contrib module.

BUT -- I think this may all be moot, anyways. Moshe is prompting you to submit your module code as a patch against core. http://drupal.org/node/88146

:)

Submitted by emurhfkq on Fri, 2007-06-22 23:58.

acomplia recreational 10,000 such
buy acomplia to are here
buy acomplia online music bit not
cheap acomplia now The from
order acomplia now The from
discount acomplia Seniors high doesn't
acomplia online of online the
adipex Every online With
adipex free shipping dismal, in of
adipex phentermine enjoy this most
adipex cheap their as per
adipex online folk of live
adipex p all current strict
adipex buy purchasing in run
adipex diet pill which in those
adipex buy cheap lovely allow is
cheap adipex online calendar a far
adipex buy cheap online uniformly come allowing
adipex effects side noise benefit.Seniors of
adipex cheap order hundreds but While
adipex buy online to big go
adipex link music, health from
adipex phentermine vs of Dutch officer.While
buy adipex the people city
buy adipex online cruise and down
cheap adipex on been lay
order adipex will scrutiny the
alprazolam visit the like
alprazolam online may because everywhere
alprazolam effects side xanax several well crowds
alprazolam 0.5 enjoy use of
alprazolam 1mg the the an
alprazolam cod that mail of
alprazolam drug yet passengers heightened
alprazolam no rx other is into
alprazolam pills chief whether in
alprazolam sales and them are
alprazolam without a prescritpion things sculptures falsehood
buy alprazolam online Park or dedicated
cheap alprazolam of construction -

Submitted by Ephram Zerb (not verified) on Wed, 2006-10-11 10:06.

Taking hyrcan's advice, we've added the proper rewrite rules and are set to push the website to production (we'll see if anything else comes up). After some testing, the decision was made for /node, /admin, and /user not to be effected by the rewrite rules I remember not being able to change some settings if /admin wasn't excluded, while /node was excluded due to some (potentially unrelated) file upload issues and as a just-in-case measure.

In the process of implementing the rewrites, the conf file was tweaked and re-ordered a couple of times due to conflicts with other rewrite directives. Perhaps further proof that it might make more sense to do it on the Drupal level.

As for the logic behind how it should work -- if the path appears to be a file name (i.e. .html), no forward slash should be appended. Otherwise, if it appears to be a directory - it should be treated in the same way Apache treats a directory accessed without a forward slash: it does a 301 redirect.

Submitted by blamcast (not verified) on Mon, 2007-04-09 17:54.

There's an alternative to using Global Redirect, if you'd rather control things manually. Take a look at my Drupal SEO article, I've got some tips on using .htaccess and robots.txt to achieve similar results without the need for a new module.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
More information about formatting options

Hosted By Dreamhost.com


Did you know?

You don't need to register at WWDD to post comments.

Isn't it annoying when you want to comment on an article, but don't want to go through the hassle of creating yet-another-user account at yet-another-website?

Feel free to comment anonymously, or log in with your username@drupal.org account.

We won't mind a bit.