1

On some occasions, I've seen Drupal able to detect things like language and rewrite the url accordingly, so your actual displayed url reflects the detected value (like from http://www.mysite.com/foo/bar to http://www.mysite.com/en/foo/bar)

I want to do that based on the $theme_key. I want all the data, when displayed in the 'fancytheme' theme, rewritten from http://www.mysite.com/foo/bar to http://fancytheme.mysite.com/foo/bar

  • is that possible ?
  • how would i go about ?
  • is there a module out there that already does that ?
2
  • It sounds like you are already using the theme_key module - you want the url to switch only when its switched to the different theme, correct?
    – schnippy
    Apr 13, 2013 at 21:40
  • exactly - yes i'm using themekey. i didnt find a way to do it with that module, is there ?
    – commonpike
    Apr 14, 2013 at 10:16

1 Answer 1

0

Normally, you could accomplish this with URL rewrite rules or theme switching modules like ThemeKey but you're moving to a different sub-domain which Drupal is going to assume is a new database. The best way to do this then is to use the Domain Access module to simulate the use of a sub-domain without switching your database.

Domain Access is a little trickier to setup (read the install file carefully) but it allows separate themes for each subdomain with the "Domain Theme" module.

Domain Theme -- Allows separate themes, theme settings and colors for each subdomain.

3
  • thanks for the suggestion .. not sure if I understand the answer. I dont want to change the theme based on the url, i want to change the url based on the theme. how would you 'normally' accomplish this with ThemeKey ? URL rewrites are fine too, but how would apache know what theme i'm going to be in ?
    – commonpike
    Apr 14, 2013 at 19:04
  • right - but the url you are changing it to is a subdomain which will be interpreted by top-level drupal handling to look for a new database or sites folder. If you don't want to use a subdomain url (ex. mynewurl.samesite.com) but could use a same domain URL (ex. www.samesite.com/mynewurl) than you can easily do what you're asking in ThemeKey or Context, or any other theme switcher. If you want to use a subdomain, you want domain access because it interrupts the domain handling functionality before it triggers based on your rules.
    – schnippy
    Apr 14, 2013 at 20:30
  • ok .. suppose I dont use a subdomain, but a subdir, how would I do it using themekey ? so f.e. mysite.com/foo/bar gets rewritten to mysite.com/fancy/foo/bar ? do note, the original url is /foo/bar, it gets the fancy theme from, for example, a tag attached to the node
    – commonpike
    Apr 14, 2013 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.