2

Maybe I'm making this way more complicated than I need to, but I want to serve my Drupal site that I've installed at 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 do I need to modify: .htaccess or add a redirect in cPanel? I can't imagine I'm doing anything radical here, but there's no clear-cut answer in all my searching.

  • What exactly isn't working? accessing example.com/drupal should basically just work. – Berdir Jul 16 '17 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. – the_meter413 Jul 17 '17 at 18:48
  • 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 Jul 17 '17 at 20:44
3

I just had the same problem. I have solved it with htaccess file(ie. not nginx) in the root directory with the following code(although I have tested it only with simple index file, not with fully installed Drupal):

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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