In Drupal 6 I was able to successful install Drupal in a subdirectory called drupal and then reference the site without having to use example.com/drupal. In Drupal 6 to get this
On Apache server, add this to the root .htaccess file.
RewriteEngine on RewriteRule (.*) drupal/$1 [L]
Update the drupal settings.php file (in /drupal/site/default/ directory) so that the $base_url line reads:
$base_url = 'http://www.example.com';
Try with this :
RewriteEngine On
RewriteBase /example.com
RewriteRule ^$ drupal/ [L]
# rewrite rules for drupal files
RewriteCond %{DOCUMENT_ROOT}/example.com/drupal/$1 -f
RewriteRule ^(.*)$ drupal/$1 [L,QSA]
# rewrite rules for drupal paths
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ drupal/index.php?q=$1 [L,QSA]
Put this .htaccess file in example.com directory. You don't have to modify drupal7 .htaccess
I answered a very similar question on this here: Two Drupal installation on the same server My answer to your question is the same, I recommend eschewing the rewrite method in favor of the virtual host method as described below (which is just an excerpt of what I answered in the link above):
... To do this correctly you must first enter the following line (or un-comment the line if >it already exists):
NameVirtualHost *:80
Next you must create the two virtual host entries. One will be similar to the following:
<VirtualHost *:80> ServerName your.url.fortheroot ServerAlias alternate.url.fortheroot DocumentRoot "/path/to/webroot" </VirtualHost>
The next entry would be similar to the following
<VirtualHost *:80> ServerName your.url.forthesubfoldertest ServerAlias alternate.url.forthesubfolder DocumentRoot "/path/to/webroot/test" </VirtualHost>
...
In your case, however, you would only require one virtual host entry & not two.
Additionally, it should be noted that, should you desire to serve a site from a location NOT in your webroot then you would also need a
<Directory></Directory>
entry to tell Apache what access to give to visitors (NOTE: in Linux the Apache user should be made owner of the files [or permissions should be set in a method that still allows the apache user rights to serve the files if you want to avoid giving it ownership])