3

I've just copied my drupal website from local to server, everything is fine except the url of the site is http://www.mydrupalsite.com/mydrupalsite.com/index.php (although there is no folder named mydrupalsite.com)

The server directories and files are like this:

  • root
    • .htaccess
    • mydrupalsite.com
      • index.php
      • other drupal files...
      • .htaccess (drupal one)
    • myothersite.com
      • ...

I don't think the root htaccess file has something to do with it, because myothersite.com has no problems with it. Is it possible that the .htaccess file of the drupal is causing it? If so, how to prevent it?

I made some changes and tried this in root .htaccess, but it still doesn't work:

RewriteEngine on
RewriteOptions MaxRedirects=2
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]+)$
RewriteCond %{QUERY_STRING} !^(.*)redirect=1(.*)$ [NC]
RewriteRule ^(.*)$ /%2.%3/$1?redirect=1&%{QUERY_STRING}

To sum it up, I found out that this structure has been created by previous admin and should not be changed (as there are two domains). I guess the problem could be solved by removing the /mydrupalsite.com/ when present in url with .htaccess somehow, but finally I've been said it does not matter, so I left it as it is.

8
  • 5
    Check sites/default/settings.php...do you have a $base_url defined in there? If so, set it to a blank string
    – Clive
    Aug 16, 2012 at 15:10
  • @Clive Answers man! ;] Aug 16, 2012 at 15:24
  • @Clive I guess that is the answer. ;)
    – apaderno
    Aug 16, 2012 at 15:27
  • 2
    I notice that you say that there is no folder called mydrupalsite.com, but in your directory listing, you show mydrupalsite.com... it seems to me that your virtual host is probably pointing your domain to root and not to mydrupalsite.com
    – Chris
    Aug 16, 2012 at 16:06
  • 1
    Did you create that directory structure, or was it created for you from some tools, and you cannot change it? @Clive On SO you aren't the top user. :) Anyway, I was not serious, before: Effectively, it was too early to answer to this question. Basing on the answer I get on my question here, users can decide on which answer better suits this question.
    – apaderno
    Aug 16, 2012 at 18:43

2 Answers 2

2

If I understood your question correctly, and given the directory structure, you'll want to modify the .htaccess (the one in the root directory) so that requests are rewritten.

To do so, find and modify (or add) the following line:

RewriteBase /mydrupalsite.com

3
0

If http://www.mydrupalsite.com, and http://www.myothersite.com are two domains that point to the same web server, you can set a multi-site configuration.

A multi-site configuration allows you to run Drupal on two different domains that point to the same web server copying the Drupal files in a single directory. Basing on the domain name used when accessing the site, Drupal will use a different settings.php file, which means the sites can also use different databases.
If you install Drupal on the document root directory of the web server, your sites will appear at http://www.mydrupalsite.com, and http://www.myothersite.com, without any additional paths.

I actually used a multi-site configuration for my site: Instead of having two copies of the files for the main domain, and its subdomain, I have a single copy of the files. In my case, I simply added a DNS entry to point blogs.mysite.com to mysite.com. (I have used an A entry, as I am using a static IP.)

See Multi-site how-tos including videos for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.