Hi.

I'm not sure if this should turn into a feature request, a bug report, or remain a support request, so I'm playing it safe ;).

I think the redirects from domain alias should be 301 by default, so spiders know it's a permanent move. Either that, or the typical use case for this is not the same as mine. I suppose we *could* provide a check box to allow either, but I guess that depends on whether my assumptions are correct in the first place, and whether it's necessary to allow both options.

My original reason for posting this is that google maps is refusing to update some of the pages in the "more info" section about a listing. I'm assuming a 301 would do it for them.

Thanks,
Al

Comments

agentrickard’s picture

Right now, we're just using the default drupal_goto(), which is a 302.

http://api.drupal.org/api/function/drupal_goto

A feature request would make this configurable, so you could specify 301 or 302. An advanced feature request would let you specify that _per_ alias.

captainack’s picture

Category: support » feature

Thanks for the light-speed reply!

For me, I'd be okay with a global option, but I'd imagine I'm a minority, otherwise 301 would have already been the default. In looking over the code, it doesn't look too hard to make a per-alias option, thanks to the code being so well organized. It looks like the value is stored as a tiny int, so the upgrade should be easy too.

Would it make sense to you to display this as a radio button? e.g.
Redirect? o No / o 302 / o 301

Thanks,
Al

agentrickard’s picture

I'd say global option for D6, per alias for D7, since this requires a database update in {domain_alias).

agentrickard’s picture

Version: 6.x-2.4 » 7.x-2.x-dev
Status: Active » Postponed

Postponed to D7.

agentrickard’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Postponed » Active
jan.s’s picture

I would like to get the function adapted, so I can pass the value.

I need it for a custom module. In that cases you don't need a settings form etc.

http://drupal.org/node/1566058

agentrickard’s picture

I think a patch that makes the "redirect" option a select list would be fine. Then we need to change the data storage in {domain_alias} and the redirect behavior.

Options:

* 0 :: Do not redirect
* 301 :: Permanent redirect (301)
* 302 :: Temporary redirect (302)

Ignigena’s picture

I've attached a patch below that adds this functionality. The approach I used is in order to maintain existing default functionality of a Domain Alias redirect. I think it's arguable whether existing domain aliases should be changed to 301 redirects for SEO purposes. But rather than debate this issue, the patch just maintains the current setting for any sites with the module installed and adds the option to change this to a 301 redirect.

This changes the Redirect checkbox on the admin page to a radio button with the three options mentioned above. The database still stores the selection as an INT but doesn't convert this to a BOOLEAN and rather interprets the stored value as either 0 meaning no redirect or 301/302 as the actual redirect code. There is a hook_update method to convert all old Domain Alias redirect columns to the new storage as well as logic to prevent bad HTTP status codes if the update hook isn't run. Both convert any existing redirects enabled in Domain Alias to a 302 status code which was the previous default.

Ignigena’s picture

Status: Active » Needs review
Ignigena’s picture

Changed this to a select list rather than radios to keep the UI a bit cleaner.

Screenshot attached.

agentrickard’s picture

Makes sense.

abuzakaria’s picture

Issue summary: View changes

When will this feature be added to the build?

agentrickard’s picture

When it has been reviewed properly by someone other than the maintainer.

begun’s picture

I just tried the patch on my local system and tested the three different redirect options on different domains. All worked correctly.

royharink’s picture

I have successfully tried and tested the patch supplied by Ignigena in comment #10.

royharink’s picture

Status: Needs review » Reviewed & tested by the community

  • agentrickard committed 719fc7a on 7.x-3.x authored by Ignigena
    Issue #772406 by Ignigena, royharink, captainack: domain alias redirects...
agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.