I added Themekey to an existing site, so that I can add an "m." mobile site within the site. My first step is to get requests for m.mysite.org to redirect to a dedicated new page that will be the mobile home page (m.mysite.org/mobilefront).

A request for www.mysite.org should not redirect, but a request for m.mysite.org should redirect.

The existing site is configured to have a page at /frontpage as the "Default front page" in Home » Administration » Configuration » System.

I can't figure out how to make a redirect rule that redirects the "front page" when the full path of the front page is NOT used in the request. I can get a working redirect for m.mysite.org/frontpage.

For m.mysite.org, I attempted this with two rules, the second nested under the first.

Rule 1: system:host = m.mysite.org
Rule 2 (nested): drupal:is_front_page = true

This works for m.mysite.org/frontpage, but not for m.mysite.org. Please direct me on the proper second rule(s) that will match the "site root" for m. but not www., which is the implied "front page": m.mysite.org

Thanks in advance,
Lee

Comments

mkalkbrenner’s picture

drupal:is_front_page should be the correct property.
Please turn on ThemeKey Debug to inspect the property values on the front page and report the results here.

lxcichano’s picture

Thanks for the response.

The Debug output does show the site root URL as:

drupal:is_front_page
true

However, the redirect rule does not fire. I tried changing the rules to just:
drupal:is_front_page = false

The redirect rule fires. To be clear, the redirect rule fires with 'false' as my rule value when the debug shows 'true'.

I tried changing the rule to:
drupal:is_front_page ! false

The redirect did not fire.

When I change it to:
drupal:is_front_page ! true
...The redirect rule fires.

mkalkbrenner’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
Category: Support request » Bug report

However, the redirect rule does not fire.

This sounds like a bug.

Can you test if a normal theme switching rule for drupal:is_front_page is working?
In this case we can narrow down the problem to the redirect sub-module.

lxcichano’s picture

Good idea. I just tested it, and a theme switching rule for drupal:is_front_page works fine for me.

  • mkalkbrenner committed 0f4e77e on 7.x-3.x
    Issue #2380909 by mkalkbrenner: Redirect for is_front_page does not work...
mkalkbrenner’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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