I had to change a template group name for a blog channel from news-and-blog to news-and-forum. I am trying to create a redirect in .htaccess that would redirect the old URL along with any of the blog posts.
The redirect I created works but it is redirecting all of the channel entries to the index page instead of just changing the first segment.
For example, the old URL https://mywebsite.com/news-and-blog correctly redirects to https://mywebsite.com/news-and-forum, but https://mywebsite.com/news-and-blog/my-blog-entry also gets redirected to https://mywebsite.com/news-and-forum. I need it to redirect to https://mywebsite.com/news-and-forum/my-blog-entry
Here is my .htaccess code:
RewriteEngine On
RewriteRule ^news-and-blog/(.*)$ /news-and-forum/$1 [L,R=301,NC]
# Redirects to https & www
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
I have also tried changing the order of the rewrite rule but always get the same result. And I have tried it with & without the https & www redirect.
Any insight is appreciated.