The first requirement was to redirect traffic from http://www.old-domain.org
to https://example.press
-- but only do so for the root of the domain; any specific page should be available on the old domain.
So I did a little studying, and this did the job:
RedirectMatch "^/$" "https://example.press"
(interestingly enough, https://htaccess.madewithlove.be/ claimed it doesn't work...)
Then, a next request came in: also redirect another URL, of a form:
http://www.old-domain.example/site/index.php?act=news
, but in such a way that if any specific news story was requested would not get redirected (e.g., http://www.old-domain.org/site/index.php?act=news&id=12345
)
This proved very challenging. Many docs and articles mentioned this is not possible with Redirect
/RedirectMatch
directives, but possible with RewriteCond
+ RewriteRule
, which I gathered should look something like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} act=news
RewriteRule ^(.*)$ https://example.press [R=302,L]
</IfModule>
(again, https://htaccess.madewithlove.be/ claims it works)
However, nothing seems to be working. No redirects are happening. Any glaringly obvious misconceptions on my part, eh?