Access-Control-Allow-Origin Multiple Origin Domains?

Sounds like the recommended way to do it is to have your server read the Origin header from the client, compare that to the list of domains you would like to allow, and if it matches, echo the value of the Origin header back to the client as the Access-Control-Allow-Origin header in the response. With .htaccess you can do it like … Read more

Redirect vs RedirectMatch

Redirect is supposed to redirect all URLs starting with the string. Since the URL you redirect to started with that string, naturally you instantly redirected again. RedirectMatch redirects URLs that match a regular expression. You used $ to explicitly match the end of the URL as part of that. That means that “starting with” is not enough.

.htaccess – how to force “www.” in a generic way?

I would use this rule: The first condition checks whether the Host value is not empty (in case of HTTP/1.0); the second checks whether the the Host value does not begin with www.; the third checks for HTTPS (%{HTTPS} is either on or off, so %{HTTPS}s is either ons or offs and in case of ons the s is matched). The substitution part of RewriteRule then just merges the information parts to a full URL.

.htaccess redirect http to https

Update 2016 As this answer receives some attention, I want to hint to a more recommended way on doing this using Virtual Hosts: Apache: Redirect SSL Old answer, hacky thing given that your ssl-port is not set to 80, this will work: Note that this should be your first rewrite rule. Edit: This code does the following. The … Read more