0

I'm trying to set up a server that will be used only for mod rewrite.

Most of my cases are described by a single rule that I want at the bottom of the htaccess file.

I also have a few dozen specific hosts and URI strings that I need to handle, eg:

www.example.com => anotherdomain.com
subdomain.example.com => yetanotherdomain.com/subdirectory

etc which I'd like to be able to state in a single rewrite map directive.

the rewrite map file (QA) would look something like

www.example.com anotherdomain.com
subdomain.example.com yetanotherdomain.com/subdirectory 

Is there a ready way to do so? Most of what I've seen focuses on substituting a specific part of the URI, not the entire body.

I was thinking something like this would work but it isn't quite doing the trick.

RewriteCond %{HTTP_HOST} ${qa:%{HTTP_HOST}}
RewriteRule (.*) ${qa:%{HTTP_HOST}}

What am I missing? How can I do this cleanly?

Tim Brigham
  • 15,465
  • 7
  • 72
  • 113
  • You talk of .htaccess files, rewriteMap cannot be used in .htaccess files, only on real configuration files. – regilero Nov 13 '13 at 21:41
  • You are trying to build something like a big proxy? One of your problems is that htaccess files are only read once the server has determined what file needs to be served. If you are trying to set up a server that will only do rewrites, one that will not serve any files at all you must do this in the server config. – Krist van Besien Nov 18 '13 at 07:33

0 Answers0