1

I have two different Symfony2.8 applications. During development they are accessible via two separated domains (virtual hosts): www.app1.local and www.app2.local. And everything works fine. But finally both applications should be deployed to the one server with one domain. Therefore I created two folders for each application.

Document root is /httpdocs, so file /httpdocs/test.php is accessible via www.domain.com/test.php. Two folders are /httpdocs/app1 and /httpdocs/app2. Each contains different installation of Symfony2.8 with own bundles etc.

And what is the problem? The web in URL. The URL to application looks like www.domain.com/app1/web/index.php instead of www.domain.com/app2/web/index.php. I'm trying to hide this web from URL but I don't have idea how to do this.

2

1 Answer 1

1

In general, it should be configurated via web-server itself. But if you don't have any access to configuration of web-server (Apache, nginx), you can do the following.

Put in your /httpdocs/app1 copy of app1/web, and in /httpdocs/app2 copy of app1/web

Applications themselves put in some other place. So it will look, for example, like this:

app1/
  app/
  bin/
  ... # <--no web among these folders
  composer.json
  ...
app2/
  app/
  bin/
  ... # <--no web among these folders
  composer.json
  ...
httpdocs/
  app1/
    bundles/
    ....
    index.php
  app2/
    bundles/
    ....
    index.php

And then in your index.php fix paths to application

  $loader = require __DIR__.'/../../app1/app/autoload.php';
  include_once __DIR__.'/../../app1/var/bootstrap.php.cache';

(and same for app2, but with app2).

Also, fix both composer.json

"symfony-web-dir": "../httpdocs/app1",
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.