My drupal installation is in the subfolder '/drupal'.

I hide the subfolder from the browser URL in .htaccess one folder below /drupal with these lines...
RewriteCond %{HTTP_HOST} ^.+\.myweb\.org$ [NC]
RewriteCond %{REQUEST_URI} !drupal/ [NC]
RewriteRule ^(.*)$ drupal/$1 [NS,L]

This works effectively in all my drupal sites, though I need to also set the base_url in settings.php as follows...
$base_url = 'http://www.myweb.org';

Now my problem is that on my new website I want to use the 'subdomain' module and I want to keep the user on whatever subdomain he used to enter the site. However, I cannot set $base_url in settings.php to do it because the base_url could have any arbitrary subdomain. Currently I can hit my site properly from any 'subdomain', but without the $base_url set all the links on the page default to a base_url of 'http://www.myweb.org/drupal'. That is the base url has www instead of the subdomain and also no longer hides the 'drupal' subfolder. What I want instead is the base_url to be 'http://subdomain.myweb.org' with the same subdomain used to call the page and also hiding the drupal folder.

I am hoping this can be done with the right .htaccess settings or some other fix.

I did uncomment the line 'RewriteBase /' in the .htaccess file at the drupal root directory, but this appeared to effect nothing.

Though this may not effect your answer I am also learning to use the module og - organic groups in combination with subdomain. Perhaps that will have an impace on the solution?

Any ideas?

Jeff

Comments

webservant316’s picture

Hello, anyone with ideas on this one?

jho1086’s picture

subscribing

webservant316’s picture

trying to tackle this problem via another route. that is instead of using .htaccess to point to my Drupal folder and to hide the sub-folder from the url I am hoping to use cpanel features to point my domain directly to the Drupal sub-folder instead. of course that is not a real answer to my question above.