I want to force admin pages open only and only in overlay. As you know if a link with an admin path is clicked it opens in overlay (if enabled). But if you write the URL to the browser, or use some deep link, or you are already in administration theme, the links expectedly wouldn't open in overlay.

How could I force the pages, even if the URL is entered to the browser's path, to open in overlay.

For example, if I type in the browser:


It should always open as:


2 Answers 2


I really do not recommend doing this.

However, you can use a custom rewrite rule. You will have to create this in your .htaccess file yourself.

Rewrite anything with /admin/ to use the overlay.

  • It is not only admin paths, but I also set several other paths to be opened in overlay using hook_admin_paths(). I would actually prefer a way without editing the .htaccess file, preferably using some Drupal API functions so that it consistently opens all administrative paths in overlay. Another point is that the productive server is IIS. Feb 13, 2014 at 19:05
  • perhaps I am tired today, but I really don't think that is possible. in theory, I think you could do a regex every time a page loads, and if /admin/ without #overlay, redirect the user.
    – jdu
    Feb 13, 2014 at 19:15
  • Oh I'm sorry, did you take a look at the ThemeKey module (drupal.org/project/overlay_paths), they have an API for this. I would check out how they accomplish this. An other option is rewriting those urls in your .htaccess file to make sure the use of overlays is forced Feb 23, 2016 at 11:23

You can use the context overlay module to achieve this, this way you can easily configure what pages should be opened in an overlay.

You'll need to install:

  • Thanks for the try, but I didn't ask how to configure pages to open in overlay. I already do that using hook_admin_paths(). I don't need to install 2 modules for such simple task. My question is, how to FORCE those paths to open ALWAYS in overlay. Feb 23, 2016 at 9:24

Your Answer

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

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