penders - 6:49 pm on Nov 16, 2013 (gmt 0)
Good points. To be honest, my hastily posted copy'n'paste code snippet was intended just to show the location of "a trailing ? on the RewriteRule substitution". I only removed the protocol/domain when the URL was auto-linked in the post, which messed up the output (I should have changed it to example.com - I didn't realise that isn't auto-linked).
you typically want to include the fully qualified protocol and hostname in the RewriteRule Target with a redirect unless you have a good reason not to
but if you ever move [or for some reason your host changes a setting], you could be in for a "head-scratcher" about why your site broke
I have seen a number of people mention this, but no specifics, so I am still rather curious as to why? What problems can arise? To be honest, for me, having to specify an absolute path for all redirects would result in less portable, harder to maintain code? For instance, I often test on a development server, which runs on a different subdomain, but use the very same .htaccess file on both (using root-relative URL-paths). So, I often use root-relative URLs because I am moving between servers. What changes can the host make that affects this?
Also, from the Apache docs for RewriteRule [httpd.apache.org]:
If an absolute URL is specified, mod_rewrite checks to see whether the hostname matches the current host. If it does, the scheme and hostname are stripped out and the resulting path is treated as a URL-path.