A friend of mine is moving hosts and I've been tasked with sorting out his rewrite rules. I've got most of them done, barring this awkward subdomain rewrite rule:
server {
listen 80;
server_name ~^(?<subdomain>.+)\.foo\.gg$;
location / {
if (!-e $request_filename) {
rewrite ^/([-a-zA-Z0-9]+)-$ /stats.php?code=$1&sub=$subdomain last;
rewrite ^/([-a-zA-Z0-9]+)$ /redirect.php?code=$1&sub=$subdomain last;
break;
}
}
}
I've tried this (from another serverfault thread, which doesn't work for me:
RewriteCond %{HTTP_HOST} ^([^.]+)\.foo\.gg$
RewriteRule ^([A-Za-z0-9-]+)$ redirect.php?code=$1&sub=$2 [L]
Help?