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
Related Tags
.htaccess × 2771apache-2.2 × 1101
mod-rewrite × 695
apache-2.4 × 365
redirect × 325
rewrite × 311
php × 208
nginx × 134
wordpress × 132
apache2 × 127
301-redirect × 115
linux × 113
virtualhost × 73
https × 72
subdomain × 65
rewritecond × 55
regex × 54
security × 53
ubuntu × 50
ssl × 49
httpd.conf × 45
web-server × 37
.htpasswd × 36
httpd × 35
url × 34