I'm having trouble with my Apache redirects and rewrites, and I have no idea why what I've got doesn't work. This is the goal:
Browser URL: http://127.0.0.1/app-gallery/all
Redirect (301) to: http://127.0.0.1/apps/all
Serve file from: /en/apps/all
In my httpd.conf, I have the following:
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine On
RedirectMatch 301 ^/app-gallery(.*) /apps$1
RewriteCond %{REQUEST_URI} !^/en/
RewriteRule ^(.*)$ /en/$1 [L,QSA]
With the last two lines (condition and rule) included, my browser does not get a 301 redirect, just a 404. If I take the last two lines out, the redirect happens - but then I'm obviously not serving a file from the /en/ directory like I need to be.
Shouldn't the redirect happen, resulting in a new request that doesn't get redirected, followed by application of the rewrite?
Also, I have a number more of these RedirectMatch lines in there (after the relevant one), but I removed them for sake of simplifying my example.