Move website, remove folder name from path


This is how to re-direct existing URLs to the new path after moving the site. For example purposes, I am using /folder/, please substitute your own folder name (hey, there is always one person that doesn’t).

SCENARIO: Client has a website in a subfolder on their server such as /folder/ so that the links currently indexed by google might be something like:

  • NON-SEF:
  • SEF1:
  • SEF2:

GOAL: When a user goes to those links, it automatically removes the /joomla/ but keeps the rest of the link intact. So the resulting link would be:

  • NON-SEF:
  • SEF1:
  • SEF2:


STEPS: Follow these in order, and test after each step. If your problem is solved, you do not have to do rest of them.

1. If in a content management system, adjust the base url ONLY if you see the /folder/ in it.

a. WORDPRESS: in the wp-config.php, remove /folder/ from $baseurl = ‘‘;

b. JOOMLA: in configuration.php, remove /folder/ from var $live_site = ‘’;

c. DRUPAL: in ‘sites/default/settings.php’, remove /folder/ from $base_url = “”;

2. In the .htaccess file, you would add this code or remove any existing /folder:

RewriteEngine On
RewriteEngine /


3. Add this code BELOW the previous step’s code:

RewriteCond %{THE_REQUEST} ^GET\ /folder/(.*)
RewriteRule ^folder/(.*)$1 [L,R=301]


TESTING: The main reason we bother to adjust links is so any pages indexed by Google do not because broken links.  So the best way to test is to actually search for your index pages and then just click through them.  I will generally hold down the CTRL key while clicking through them so they open in new tabs.

About YellowWebMonkey

YellowWebMonkey Web design offers reliable website design, SEO and digital marketing services for Joomla, WordPress and Shopify sites. We strive to be a one-stop shop for all your web needs.

Recent Posts

Follow Us