I hope someone might be able to give me some specific advice for this. I've searched the forums, but found only similar questions to mine with partial answers.
Since I had to upgrade to Drupal 5.8, and now 5.9, I thought it would be a good time to move my drupal installation to a subfolder to keep things tidier and easier for future upgrades. I also have subfolders for moodle and webmail, so my public_html is getting pretty full, and I get a little nervous everytime I have to upgrade. I made a new 'drupal' subfolder and did a manual install, copied sites/all, modules, etc. For a while I could get to my admin pages, but then after fiddling around I lost access to even those, as well as css (everything looked like plain html). I found two references to redirecting using .htaccess and tried to implement them, but I don't really know what I'm doing here. Any help?
http://helpdesk.bluehost.com/kb/index.php?x=&mod_id=2&id=394
http://drupial.com/content/drupial-installing-drupal-a-subfolder
Anthony
Comments
Hi anthonym, I don't think
Hi anthonym,
I don't think it matters where you have your drupal install. When you first installed Drupal did you make a new folder / directory in drupal/sites/ directory? Out of the box Drupal has a "default" directory, like:
drupal/sites/default
Did you add a new directory there like:
drupal/sites/www.mydomain.com
??
If so, you will need to change that path. If not, you need to go to your settings file inside:
drupal/sites/default/settings.php
And add the base_url, IE:
$base_url = 'http://www.example.com/drupal'; // NO trailing slash!
Be sure to remove the # sign.
Once that is done, you need to login (don't worry if your theme isn't looking right):
http://www.example.com/user
Then go to:
http://www.example.com/admin/build/modules
Scroll down and click on submit. Then go to:
http://www.example.com/admin/build/themes
Then scroll down and click on submit. Once that is done, clear your cache, go to:
http://www.example.com/admin/logs/status/run-cron
Now, you said you were doing an upgrade, so now you need to run an update to make sure no tables in the database need to be updated:
http://www.example.com/update
From there you should be good to go. Report back to let us know any problems or questions you might have.
Good luck
===
Elvis McNeely
Drupal services: http://www.elvisblogs.org/drupal
progress!
Hi Elvis,
Thanks for the reply. I was actually able to get restore things back the way they were and then try again with the subfolder install. It all seems to be running fine now for the most part, but the .htaccess redirect is not working right. The big problem is that you cannot get to the frontpage of my site just from the base url: i.e. http://anthonymosakowski.com doesn't work, but http://anthonymosakowski.com/drupal does. However, for other pages, the drupal folder prefix is not needed: i.e. http://anthonymosakowski.com/compositions works the same as http://anthonymosakowski.com/drupal/compositions. At the moment I'm not getting any CSS or graphics on any pages, but yesterday things were okay, so I'm assuming this might have something to with my host backing up some files (I hope). The relevant lines from the current working copy of my .htaccess file in my public_html directory are:
RewriteCond %{HTTP_HOST} ^www\.anthonymosakowski\.com$ [NC]
RewriteRule ^$ drupal/index.php [L]
RewriteCond %{HTTP_HOST} ^www\.anthonymosakowski\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/drupal%{REQUEST_URI} -f
RewriteRule .* drupal/$0 [L]
RewriteCond %{HTTP_HOST} ^www\.anthonymosakowski\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* drupal/index.php?q=$0 [QSA]
Any ideas on what I can change to get the index page to show up?
Anthony
--
anthonymosakowski.com
update
Okay, so maybe I was wrong about the host backing up causing the css problems. According to my browser's activity window, I'm getting a lot of "not found" messages on css, js, images, etc in various directories. Obviously this htaccess file is not working. I'm sure it did the other day, but it's possible I changed something and don't remember. I'm sure that my drupal installation is correct, it just seems that for some reason at the moment it is inaccessible to the browser. I don't know what to do here. Can anyone help?
Anthony
--
anthonymosakowski.com
still troubleshooting
Still troubleshooting this: I disabled (by renaming) my various non-working htaccess files, so I have only the blank automatically generated one in my root dir. I can access individual pages in my drupal subfolder manually, but none of the CSS, js, or image files are loading: i.e. http://anthonymosakowski.com/drupal/compositions produces a page of plain html but in the browser there are many page not found messages such as 404 Not Found The requested URL /files/color/garland-e5dcc106/style.css does not exist. This was the same even with the partially working htaccess file. Any help?
Anthony
--
anthonymosakowski.com
another update
Still no ideas for this yet? It seems like the CSS issues were due to my browser loading the pages from the caches rather than from the web. I emptied the cache, and now this is fixed. Does anyone have any ideas on the htaccess redirect?
Anthony
--
anthonymosakowski.com
Anything on this yet?
I just got started with drupal and ran into this. I also installed drupal to a subdirectory of the site as I had / have an exisiting site already. I put it in a subfolder cms, changed the settings.php file and run into a few problems.
I tried using $directory in the template before the images and flash paths and js, but it does not work. The stuff that gets processed by drupal ($script, left and right) seem to all have the base_path transformed correctly, but the template does not have access to the $base_dir it seems.
Did you find anythign yet?
BTW, 1and1 hosting will turn off register globals if you ask real nicely.
I copied and modified a core theme (garland I think, or whichever is table based ... sorry, noob). I aded this to the template:
define( 'MY_BASE_DIR', $base_url .'/'. $directory);
and tried this to get the theme to use the correct paths so I can put all the content files in the theme dir as best practice for drupal.
language="JavaScript" type="text/JavaScript" src="
echo $base_url .'/'. $directory/js/AC_RunActiveContent.js">language="JavaScript" type="text/JavaScript" src="
echo 'MY_BASE_DIR'/js/AC_RunActiveContent.js">The template does not have access to the corrected $directory, nor the $base_url. The drupal generated css from the template info file is correct. JS can not be included in there for google analytics or 3rd party JS libs though. My relative image paths do not work either.
1and1 a no go
I was wrong about 1and1 hosting. I guess it is possible, but I have put a modified php.ini in about 20 folders, and register globals is still on in some install path. :(. No htaccess file will override the setting, nor a ini_set().
base_path, ot base_url
The templates can see the $base_path variable, just not the $base_url. So try to use $base_path . $directory (base path is already slashed to root and above folder '/basepath/') in front of your images, etc.
easy way to test your template is to stick this in the head section of the page.tpl.php
<!-- <?php echo 'bp:'. $base_path .' burl:'. $base_url .' tb:'. $directory ?> //-->
This will work for JS includes as well. Any paths in your css will not work, so absolute paths, re-write rules or a copy of a background image for the theme will have to go in the root folder. I tried to make the css file a php file, but firefox did not like it, even though it was just a renamed css file for testing purposes. Probably a security measure on ff's side.