I want to serve my Drupal site which is installed on example.com/drupal from example.com.

This particular site is an add-on site on my shared host, so the actual file structure is public_html/example.com/drupal.

What should I do, change the .htaccess file or add a redirect from cPanel?

I can't imagine I'm doing anything radical, but I did not find any clear-cut answer.

  • What exactly isn't working? accessing example.com/drupal should basically just work.
    – Berdir
    Commented Jul 16, 2017 at 10:09
  • Right, I can access example.com/drupal. I want to serve my site from example.com. There seems to be a lot of widely varying information on how to achieve this on the Drupal.org forums - mostly involving modifying $baseurl in settings.php, which doesn't seem to be a valid solution, actually. Wouldn't a redirect in .htaccess be the preferred method? My question here is an attempt not only to help myself, but also preserve the best response for the rest of the Drupal community. Commented Jul 17, 2017 at 18:48
  • 1
    Yes, the .htaccess is OK if that's what you want. But I'm not really sure why you put drupal in a sub-folder when example.com should serve Drupal and only Drupal?
    – Berdir
    Commented Jul 17, 2017 at 20:44

1 Answer 1


On an Apache server, adding the following lines to the .htaccess file should help.

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_URI} !drupal/
  RewriteRule (.*) /drupal/$1 [L]

Those lines have not been fully tested. Use them at your risk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.