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

  1. Ensure to take a backup of an existing file (.htaccess or httpd.conf)
  2. Add the 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.