HTAccess Redirect all Subpages

I’m trying to redirect all subpages of a page using .htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^/news-and-events(.*)$ /news/$1 [R=301,L,NC]

The above doesn’t seem to be working, what’s the easiest way to do this in as few lines as possible?

Read More

My HTAccess:

# 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

RewriteRule ^news-and-events(.*)$ /news/$1 [R=301,L,NC]

Related posts

Leave a Reply

1 comment

  1. Remove leading slash:

    RewriteRule ^news-and-events(.*)$ /news/$1 [R=301,L,NC]
    
    • .htaccess is per directory directive and Apache strips the current directory path from RewriteRule URI pattern.