I'm trying to apply two 301 re-directs in my .htaccess file within WordPress, but I get a 404 error.
Here's what I have:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# X-XSS-Protection
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
# X-Frame-Options
<IfModule mod_headers.c>
Header always append X-Frame-Options SAMEORIGIN
</IfModule>
# Security Headers - X-Content-Type: nosniff
<IfModule mod_headers.c>
Header set X-Content-Type-Options nosniff
</IfModule>
# BEGIN 301 Redirects
Redirect 301 /old-page-name/ https://www.myurl.com/new-page-name/
Redirect 301 /another-old-page/ https://www.myurl.com/another-new-page/
# END 301 Redirects
What am I doing wrong here? I've also tried putting the re-direct info above the WordPress settings.
Ordering of rules and mixing of
mod_rewrite
rules withmod_alias
(Redirect
directive) will cause problems.Have your rules like this: