Apache is a wonderful web server and I love it because of its flexibility.
I had my site under subfolder and I decided to move to the root level of the domain.
The main challenge was to keep all articles on the same path as a subfolder.
Guess what it’s possible through
RewriteCond in Apache web server.
This is possible through “.htaccess” or “httpd.conf” file
- Ensure to take backup of existing file (.htaccess or httpd.conf)
- Add below line and save the file
RewriteEngine on RewriteBase / RewriteRule ^subfolder/(.*)$ /$1 [R=301,NC,L]
This worked for me and I hope for you too.