Forum Moderators: Robert Charlton & goodroi
[edited by: phranque at 8:55 am (utc) on Mar 6, 2017]
[edit reason] exemplified "mydomain" [/edit]
Dated May 1996.
Again, HTTP/1.0 requests include a Host header at my server. Guess things have changed since that document was written
(Name-based virtual hosts) will not work with very old HTTP/1.0 browsers that do not send the hostname as part of requests. Since the "Host" header is mandatory in HTTP/1.1, which was issued in 1999 as RFC 2616, this is not a common issue.
I meant that if you (the browser or robot) are sending a request to a server that happens to have multiple domains living on it, how else do you tell the server what domain/hostname you're aiming for, if not with a Host: header?
However, HTTP/1.0 does not sufficiently take into consideration the effects of hierarchical proxies, caching, the need for persistent connections, and virtual hosts.
clearly there exists some mechanism for HTTP/1.0 robots to include the header, even if they're not required to do so.
Request-Header field names can be extended reliably only in combination with a change in the protocol version. However, new or experimental header fields may be given the semantics of request header fields if all parties in the communication recognize them to be request header fields. Unrecognized header fields are treated as Entity-Header fields.
yes, you can construct a request that sends a Foo request header if you wish.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] https://www.MyDomain.com , it would result to another 301 redirect to https://www.mydomain.com , which I believe is unnecessary overhead. Domain names aren't case sensitive in the first place and won't have any issues with duplicate content I think. There's one issue I've noticed, though. For example, sometimes I use Pascal Casing to stand out as my domain name uses two words. If I do redirect test, say, it would result to another 301 redirect tohttps://www.MyDomain.com, which I believe is unnecessary overhead. Domain names aren't case sensitive in the first place and won't have any issues with duplicate content I think.https://www.mydomain.com
How will I modify the above code so that the final https domain is not case sensitive? I see that wired.com was able to implement this flawlessly.
No distinction is made between upper and lower case.
By convention, domain names can be stored with arbitrary case, but domain name comparisons for all present domain functions are done in a case-insensitive manner
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC,OR]
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
Since I don't log headers for 301 responses--in fact I wouldn't even know how to do it
Conclusion: may as well stick with example.com without the [NC] flag.
The only people who request EXAMPLE.COM will be robots. Um. As it were.
internally rewrite that request to a script which logs the headers and then reexamines the request with the same rules as your mod_rewrite ruleset(s) to respond with a proper Location: header and a 301 status code
unless the user agent is folding the hostname to lower case first
I tried Safari and Camino (on the off change that case-leveling is a recent browser thing). Both lower-cased whatever I typed in (ExamPle.com) before sending it along to the server, so no 301 shows up in logs.
try to validate your document on w3c or check for wcag compliance and provide a CamelCased hostname?
avoiding unnecessary chained redirects
that should never be a problem, so long as the target of any specific redirect uses the same protocol and hostname as the fallback generic redirect