I have the following code in my .htaccess
file:
redirect 301 /file-a /folder1/file-a.html
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
RewriteRule ^(.+?\.html)/ /$1 [R=301,L]mediyaar
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1
The above code is giving me the desired results but too many redirects are there.
I am looking for below redirection of my pages, can this be achieved with a single redirect
https://www.example.com/file-a
( redirect 301 to )https://www.example.com/folder1/file-a.html
https://www.example.com/folder1
( Add Force Trailing Slash at the end for the folders )https://www.example.com/folder1/
https://www.example.com/folder1/file-a-b-c.html/
( remove Trailing Slash at the end for the file )https://www.example.com/folder1/file-a-b-c.html