40

If you are "shutting down a site" then you probably should not be "redirecting" the old site pages to a single page. An HTTP redirect sends a 301 response code, informing users and search engines the pages have moved. (Although mass redirects to a single page are likely to be seen as soft-404s by Google.) Instead, you should be serving a ...


2

The reason http://www.example.com/ is working and https://www.example.com/doesnotexist.html isn't is because your rewrite condition explicitly disables the rewriting if the client is accessing the site via HTTPS (which I believe several major browsers do by default now, but I don't have a source for this right off the top of my head). I'm assuming you did ...


2

Because %2 is a backreference in mod_rewrite substitution strings, that would otherwise refer back to the 2nd captured subpattern in the last matched CondPattern. There is none in the example you posted, so this is replaced with an empty string - so it looks like it is simply "stripped". For any sequent of %n (where n is 0-9), you need to backslash ...


2

Solution RewriteRules must use \x instead of % in order to match %-encoded URLs! (PCRE syntax for byte sequences) mod_rewrite-config uses PCRE regex syntax, and operates on decoded URLs, so typing a %-encoding in a RewriteRule pattern causes it to look for the literal %-character, not an encoded value. The correct escape-character in RewriteRules is \x, so ...


2

You can't "convert encodings" as such using only mod_rewrite, however, you can search for that specific sequence of characters in the requested URL and "correct it". http://localhost:60151/load?file=http://example.org/project²/some/data/file.bam RewriteRule (.*)project%B2/(.*) $1project²/$2 [NE] Note that project² appears as part of ...


2

RewriteCond "%{QUERY_STRING}" !^v=${versions:version} This doesn't work because the CondPattern (2nd argument to the RewriteCond directive) is a regex and consequently does not support variable expansion. (Just as you can't use backreferences of the form $n or %n or server variables %(SERVER_VAR} or env vars %{ENV:MY_ENV_VAR} etc.) It would ...


1

Shouldn't this work? RewriteEngine On RewriteRule ^ index.html


Only top voted, non community-wiki answers of a minimum length are eligible