0

Currently i'm trying to installing a drupal 7 installation in a subfolder of another drupal public_html folder, but it doesnt seem to work. I am getting a redirect loop error in chrome. I already modified the .htaccess in the parent drupal installation to ignore the sub-folder and i also set the $base_url in the sub-directory drupal installation.

2

When I do this, provided I have a clean install, I do not modify anything. Take the domain http://diw.ifi.uio.no/, where Drupal is installed in both /www/, and /www/gruppe01/, etc. (I just create the number of subdomains I need for various experiments). My DocumentRoot is set to be /www/. I just direct my browser to http://diw.ifi.uio.no/ for the main site, and http://diw.ifi.uio.no/gruppe01/ for the first subfolder site, etc. and it works - just like that.

Have you tried starting with a clean install and just install Drupal in the subfolder using the standard install procedure without changing .htaccess? (While not always necessary, I recommend that you have $base_url set correctly in the site's settings.php.)

In my experience, Drupal works fine out of the box when installed in a subdirectory of a vhost. The fact that there is another Drupal in the DocumentRoot does not make this any different, as long as each Drupal site has its own .htaccess, it will not try to read the .htaccess in any superior directory.

Examples:

  • nope i just reverted all my .htaccess and removed the base_url and still nothing.. chrome shows that its in a redirect loop error. – Patoshi パトシ May 22 '13 at 17:19
  • but that defeats the purpose... im just wondering what is causing the conflict as it has to be something to do with the root .htaccess affecting the sub directory one. – Patoshi パトシ May 22 '13 at 19:18
  • actually your right the root's htaccess file should have no affect on the subdirectory. i finally solved the issue as it was to do with modifying the subdirectory's .htaccess file to not rewrite the url to have the www prefix. apparently that was on which caused it to redirect in loop somehow. – Patoshi パトシ May 22 '13 at 20:31
  • This works perfectly. – Jayaram R Oct 30 '14 at 7:35
  • what if some url is not existed for example diw.ifi.uio.no/gruppe03/non-exiting-directory , which .htaccess will be applied? root's or diw.ifi.uio.no/gruppe03's, of course without setting $base_url just like you mentioned. – kiranking Mar 27 '15 at 17:34
0

If possible, it's better to setup the new site in it's own virtualhost, e.g a subdomain site1.example.com, site2.example.com etc..

If you want to install in a subfolder under a single vhost, you will find other odd configuration may be required (e.g embedded image paths etc.. )

If you want to go down the install in subfolder route, you've done some of the special conf and may just require RewriteBase in .htaccess to be set to the subfolder path for that site.

  • i just wanted to do a quick clone of the site to test out a drupal core update. yes i know i should have it done on a dev/stage environment, but i don't have that setup for this site. – Patoshi パトシ May 21 '13 at 23:15
  • so it seems that i have to do a subdomain setup. – Patoshi パトシ May 21 '13 at 23:16
  • If it's a subdomain setup, then access by site1.example.com rather than example.com/site1. You can redirect the latter to former, if not done already. – David Thomas May 21 '13 at 23:38
-1

Okay after fiddling around some more. I finally solved the issue. First off the .htaccess in the subdirectory override's the root's .htaccess. so that means you dont have to worry about the root's .htaccess file

Therefore, anything that needs to be adjusted is within the subdirectory and you shouldn't need to touch anything in the root directory where you have your other drupal installed.

What i did was:

  1. Comment out line 81 and line 82 of the subdirectory drupal installation .htaccess file.
  2. Un-comment the line 94 RewriteBase to where you have your subdirectory drupal installed
  3. Add in the $drupal_base variable in your sites/default/settings.php file to fix any file path issues you might have.

enter image description here

If this worked for you let me know! +1! :)

  • 1
    As I've already said, in a clean Drupal 7 install, it works straight out of the box without any of the antics you seem to resort to. – Free Radical May 22 '13 at 20:43
  • but it wasnt working so those are the changes I had to make to get it to work. it wasn't a fresh install as its a clone copy of an existing site so there could have been changes made while it was in development. – Patoshi パトシ May 22 '13 at 20:50

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.