palmic
palmic

Reputation: 1856

symfony on virtual host document root problem

Im trying to deploy symfony on virtual host.

mod_rewrite converts /web URLs to domain root URLs (domain.com/image.gif is turning internaly into domain.com/web/image.gif).

But thanks to web is executed internaly from /web dir, Symfony is still thinking it has document root there and prefixes any url_for() URLs with /web.

So when i have route:

show_books:
  url: /books

..and iam asking for:

url_for('@route_name')

Symfony is generating:

/web/books

I cant change hosting behaviour, i need to have web request pointed into symfony root path and internaly redirected into /web dir and i want to symfony ignore the point it is executed from |hostname-document-root|/web

Upvotes: 0

Views: 585

Answers (1)

palmic
palmic

Reputation: 1856

I found the insert of this code into top of my front controller (/web/index.php) as good solution:

$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] = '/index.php';

Upvotes: 1

Related Questions