New feature proposal: force specific base url

fokke - December 17, 2007 - 16:02
Project:Global Redirect
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:fokke
Status:needs work
Description

I added a new feature that lets you enter a base URL to force all requests to. This is usefull if you want all people to be at http://www.example.com or https://www.example.com instead of http://example.com. This makes statistics more clear (prevents one page to show up more than once with several base urls).

The patch is ready to be committed.

AttachmentSize
globalredirect.module.patch2 KB

#1

nicholasThompson - December 17, 2007 - 16:20
Version:5.x-1.1» 5.x-1.x-dev
Status:reviewed & tested by the community» needs work

Very nice idea! I can see EXACTLY the case where this would be necessary and preferred... However may I make 2 suggestions....

1) If we're going to make this kind of blanket-redirect, maybe we should consider those who might not want ALL pages to be on https or http. I can imagine that SOME sites might like node/5 to be on https but node/4 to be normal (maybe node/5 could contain a form that transmits secure data?). There is also the case that apache could handle a blanket redirect such as this. Just as it can handle non-www to www - it is also able to handle non-http[s] to http[s]. The apache method would be MUCH more resource efficient for a blanket redirect, however you approach (by moving it into a module) allows a far more granular and context-sensitive approach. Maybe your patch could be revised to have a "default" base URL (including protocol) but could also provide a node-specific option too?

2) Do you think it would be possible to allow the base_url redirect to fall-through to the next tests? For example, if I were to go to: http://www.example.com/node/2 and your method were to redirect me to https://www.example.com/node/2 only for ANOTHER redirect to kick in to take me to the alias... It kind of just seems to make sense to do all the checks in one go and THEN redirect. Maybe some kind of semaphore is needed to flag if/when your base_url change happens and/or the request path is changed. If either one (or both) change then you need a redirect...

I REALLY like this idea though and can see genuine use for it!

Thanks for the patch! I'd appreciate your thoughts on my suggestions.

#2

wayland76 - January 16, 2008 - 02:25

I'm in favour of your suggestions, especially your first one.

I'm tried to use your module with a multiple domain site which uses the Multiple Domains module:

http://drupal.org/project/multidomain

The problem is, Global Redirect forces everything back to the original site. So my three sites that were themed differently now suddenly have differently-themed front pages, but the other pages on each site are themed like the default site.

So, I guess I need it to be able to do the redirections, as long as the domain doesn't change.

#3

lutegrass - June 27, 2009 - 13:14

This feature is really important, especially for SEO. How about a simple checkbox:

__ Enforce leading "www." in site(s) base url

This should work with multi-sites and is probably the 90% need. Default is not checked, and the redirect should be a 301.

Editing the .htaccess is really a drag and not maintainable for large number of sites being auto-updated.

Thanks for your consideration.

 
 

Drupal is a registered trademark of Dries Buytaert.