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,655

0 Answers0