Setting up re-direct with C-Panel causes sub-pages not to load

Avatar
  • Answered
Have a Drupal site. Site was created in a sub-directory of public_html. This worked fine, except that the sub-directory was required for all sub-pages (domain mapped to the sub-directory, so the main page would show using just the domain name,, but when you gave someone a link to some other page on the site it needed to have the sub-directory in the link). So, because people have used the site and have cached links containing the sub-directory, I added a permanent re-direct using C-Panel Redirects - redirected the domain with the subdirectory extension to the domain itself, and allowed wildcards. Initially got an error that resulted in me having to delete the .htaccess file (fortunately I just renamed it). After doing this the re-direct was established without complaint, but I subsequently discovered that none of the links on the main page worked anymore (links to other pages on the site). Moreover, it was no longer possible to pull up ANY page other than the main page, either using the old address (including the sub-directory name), or with the new address (without the sub-directory name).

Eliminating the redirect and restoring the original .htaccess file returned me to my previous state where everything worked again, but I still would like to set up the redirect to handle all the cached links out there. Any ideas how to do this successfully? I suspect I need to just edit the .htaccess file, but haven't a clue how to do that.
Avatar
johnpaulb-imhs1
Hello, Thank you for contacting us about redirect issues with your Drupal site. Since Drupal and (addon modules) use the .htaccess file, making changes manually (such as in cPanel) can cause issues, or interfere with existing rules. I recommend using a Drupal module or plugin to handle redirects, such as the ones listed here. Be sure to use a module that is compatible with your version of Drupal, and it may require some testing. If you want to manually code the .htaccess, we have a full guide on Setting up a permanent 301 redirect via .htaccess. If you have any further questions, feel free to post them below. Thank you, John-Paul B