O
O
Otrivin2018-02-15 10:41:34
Drupal
Otrivin, 2018-02-15 10:41:34

Running a subdomain on drupal in a subfolder?

Hello!
It was necessary to create a large number of subdomains for the site, the hoster - runs - does not support autosubdomains and regards each added subdomain as a separate site. I will not meet the limits of the number of sites. The database and content should be different for everyone.
I decided to try to generate subdomains through htaccess - create a directory /subdomains/ , put folders with my subdomains in it, copy the site distributions into them; do the same with bases.
htaccess code

RewriteCond %{HTTP_HOST} !^www\.net-narco\.ru$
RewriteCond %{HTTP_HOST} ^(.+)\.net-narco\.ru$
RewriteCond %{REQUEST_URI} !/%1/
RewriteRule ^(.*)$ /subdomains/%1/$1 [L,QSA]

Works, opens. But there is one problem : the subdomain site generates links to its pages / css / js, taking into account nesting relative to the parent.
For example :
Parent: site.ru
Hosting subdomain path: site.ru/subdomains/volhov/
Final main subdomain: volhov.site.ru
Subdomain site nested pages: volhov.site.ru/subdomains/volhov/%some-article%
Sites run on drupal 7, I tried to use multisite modules before - I don't remember, but something went wrong. It was impossible to share some elements between the sites.
Question: is it possible to force Drupal copied into subfolders to use the base url NOT relative to the site root? So that subdomains have links to materials not volhov.site.ru/subdomains/volhov/%some-article%, but volhov.site.ru/%some-article%?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Alexandrov, 2018-02-15
@BraveHeart

Have you added $base_url to setting.php for new sites?
And there is a lot of useful stuff here: https://www.drupal.org/docs/7/multisite
For example,

  • https://www.drupal.org/docs/7/multisite-drupal/mul...
  • https://www.drupal.org/docs/7/multisite-drupal/mul...

A
Anton, 2018-02-15
@Eridani

If you need SEO, it will be easier to create a bunch of subdomains (while not creating a new site), send them to the main site, write a module that will tamper with this or that information by the domain name, for example, contact information, and, in principle, everything

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question