Problem/Motivation

On multilingual site (with path prefix) redirect page, for example node/100 is aliased and includes language prefix too early. This lead user's to be redirected from example.com/en/webform-page to example.com/en/en/redirect-page.

Proposed resolution

Clean up aliased redirect url if current language has path-prefix.

User interface changes

none.

API changes

none.

Comments

rpsu’s picture

Status: Active » Needs review
StatusFileSize
new1.28 KB

Proposed solution is to check if $language has prefix and if so, strip prefix + / off.

Prancz_Adam’s picture

Same issue here.

rpsu’s picture

And this patch applies to 7.x-4.x-rc3.

matglas86’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.34 KB

I re-applied this patch to the latest head because it did not work.

I tested it and it works.

danchadwick’s picture

Title: Multisite redirect page has doubled path prefix » Multilingual redirect page has doubled path prefix

danchadwick’s picture

Status: Reviewed & tested by the community » Needs work

Two things.

First, I just committed another change in this area of the code, so a re-roll against the current 7.x-4.x-dev will be needed for any fix.

Second, the code just assumes that the language prefix is at the start of the generated URL. This would not be the case for external URLs. I don't know enough about how the language prefix works to make a concrete suggestion. If the $language->prefix is a non-empty string, then does every single URL on the site for this language have the prefix? If so, then it would probably be easiest to include the language prefix in the regular expression used to strip base_url. The issue is that it would think that any URL's that don't have the language prefix (or have a different language) are external.

The last submitted patch, 4: multisite-redirect-2260569-4.patch, failed testing.

danchadwick’s picture

I can't test this because I don't have a multi-language installation. If someone wants to download the latest dev (23-May-2014) and try changing the preg_replace call in webform_replace_url_tokens in webform.module to the following, then we'll know if this works:

EDIT: Obsolete code deleted.

danchadwick’s picture

Status: Needs work » Needs review
danchadwick’s picture

This patch fixed a problem in #10 and improves on it. It removes the base_url and, if there is a language prefix, removes that too if it is present in the URL.

Someone with a multi-language should test this. I'm pretty confident it still works for a single language (no language prefix) installation.

danchadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Status: Needs review » Fixed
StatusFileSize
new988 bytes

Sorry. Bad patch in #12 (typo $GLOVALS and duplicated / in regular expression). Revised patch tested and applied to 7.x-4.x and 8.x

rpsu’s picture

Thanks, tested with path_prefix like example.com/en/webform-node -> example.com/en/aliased-node-path. (7.x-4.x)

Status: Fixed » Closed (fixed)

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

danchadwick’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev