5 votes

.htaccess - Redirect all URLs with one exception

As mod_alias is recommended for simple redirects, here's the solution with mod_alias: # Specific redirects: Redirect 301 /old-prefix https://www.example.com/ Redirect 301 /another-old-prefix/ https://...
  • 44.5k
4 votes
Accepted

.htaccess - Redirect all URLs with one exception

You are mixing mod_rewrite (RewriteCond, RewriteRule) and mod_alias (Redirect, RedirectMatch). The stray mod_rewrite RewriteCond directive will not do anything here. This directive only applies to the ...
  • 12k
1 vote
Accepted

htaccess: 301 redirect defined URLs to new domain and catch all redirect the rest

Redirect is a mod_alias directive (nothing to do with RewriteEngine). RewriteRule belongs to mod_rewrite. mod_rewrite is always processed first, despite the apparent order of the directives in the ...
  • 12k
1 vote
Accepted

Redirect www to non www and redirect to index.php

From what you've stated in comments, there doesn't seem to be a requirement to maintain two separate .htaccess files. In this case it would be simpler to maintain just one .htaccess file in the ...
  • 12k
1 vote

.htaccess not working but is enabled

<Directory /> Options FollowSymLinks AllowOverride All You should never set AllowOverride All for the entire filesystem (ie. inside the <Directory /> container). This should be (and ...
  • 12k

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