We have a permanent 301 redirect that is set up for an old site that is now being redirected to a page on a new site. Is it even possible to set up an .htaccess rule on our new sites Apache server to direct requests coming in from this old '301 redirected' site to a specific page on the new site?
We have a rule in our .htaccess file that contains a condition that the request is coming from the old domain and if it contains a querystring in the requested URL. Depending on the querystring, we're redirecting to a certain page, but it doesn't seem to be working so I'm wondering if it's even possible:
RewriteCond %{HTTP_REFERER} ^http://oldomain.com [NC] RewriteCond %{QUERY_STRING} ^thequerystring=([0-9]*) RewriteRule ^(.*)$ https://www.newdomain.org/redirect.php?theimage=%1 [R=301,L] The Apache version is Apache/2.4.57 (Unix) and the nginx is 1.22.0
.htaccessare typical Apache httpd tools but you then mention a nginx version. Ngninx does not support.htaccessfiles. Typically people only have one web server running at the same time so what are you running?^thequerystring=([0-9]*)matchesthequerystring=<anything>(and the backreference can be empty) - is that the intention? Can normal visitors to the new site request this URL? Or is it only a URL that redirected users from the old site will visit? Otherwise, there is no way to detect a "redirected" request, since the redirect itself does not generate a referer.