PDA

View Full Version : software in subdirectory but run from root?


isaac
03-09-2008, 04:44 PM
Hi,

I installed drupal in my subdirectory http://www.mysite.com/www/DRUPAL

Currently i am accessing it as www.mysite.com/DRUPAL

I would like it to be accessed as www.mysite.com

.......

In this regard, i found and tried the following piece of code. It works for many others but I am not sure why it does not work for me.

.......

The steps are:

(1) Edit the root .htaccess

I deleted off the existing contents:
Options +Indexes
php_value error_reporting 7
php_flag display_errors off

I added the following:

Options -Indexes
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule .* http://www.mysite.com/ [L,R=301]
RewriteRule ^$ drupal/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/drupal%{REQUEST_URI} -f
RewriteRule .* drupal/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* drupal/index.php?q=$0 [QSA]

I changed 'mysite.com' to my domain name. I changed 'drupal' to 'DRUPAL'.



(2) Edit DRUPAL/.htaccess

"<IfModule mod_rewrite.c>" is replaced by <IfModule XXXmod_rewrite.c>


(3) Edit DRUPAL/sites/default/settings.php

But here, as "$base_url = 'http://www.mysite.com';" is already asterisked out, no action is needed.


But try as i might, it does not work.


Can anyone please help? Thank you a lot for averting premature grey hair.

isaac
03-12-2008, 05:34 AM
Hi,

(1) Drupal workaround: well, that above did not work...

(2) Permanent redirect with Apache: change the .htaccess with the following:
Redirect permanent / http://www.example.com/newpage.html

The .htaccess at the root was changed - did not work
Add a .htaccess at the www - did not work

(2) Do a meta redirect: created a html file with the following:
<html>
<head>
<meta
http-equiv="Refresh"
content="5; url=http://www.example.com/newpage.html">
<title>Redirecting To Our New Page</title>
</head>
<body>
In a few seconds you will be redirected to our new page. If not,
just <a href="http://www.example.com/newpage.html">click on this
link to go to our new page.</a>
</body>
</html>

create the html file in www dir - did not work
create the html file in root - did not work

(4) Reinstall Drupal in root - did not work

(5) Reinstall Drupal in www - did not work

:eeww:

kitchin
03-12-2008, 05:38 PM
Typo in your post, you have to (2)'s.

(2)If you read http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirect carefully, you can see what's wrong, it will try to add any URL *onto* the new URL, not replace it. Instead

RedirectMatch 301 ^/$ http://www.mysite.com/DRUPAL/
# (this is a comment and an easy way make sure it ends in a blank line)

might work. The trailing / is helpful too, it takes out one more redirect. Upload as ASCII/text to /big/dom/xYOURACCT/www/. The # is to make sure it ends in a blank line.

(3) Should work, assuming you have the right http://www.mysite.com/DRUPAL/ in place. But even easier is:
1. In www, delete any index.* files, such as "index.html".
2. Create and upload "index.php" containing <?php
header('Location: http://www.mysite.com/DRUPAL/');
exit;
?>

isaac
03-13-2008, 03:22 AM
appreciate your reply....

after trying for about 3 days almost non-stop, i decided to do a re-installation of drupal so that it can be directly accessed from www.abc.com...takes me only 6 hours to set it up...a bargain

again, appreciate your reply