contao / installation-bundle

[READ-ONLY] Contao Installation Bundle
GNU Lesser General Public License v3.0
8 stars 9 forks source link

Redirect during instalation. #25

Closed ghost closed 8 years ago

ghost commented 8 years ago

Issue by @wad2eq August 1st, 2016, 07:19 GMT

I'm trying install contao on localhost i put in adress bar localhost/contao/web/install.php i check box i agree with Contidion and i get redirection do localhost/contao/install and error 404

ghost commented 8 years ago

Comment by @leofeyer August 1st, 2016, 07:29 GMT

You need to set up a document root pointing to the /web subfolder, so you can e.g. access the install tool via http://contao.dev/install.php.

ghost commented 8 years ago

Comment by @aschempp August 1st, 2016, 08:25 GMT

This is a bug I can confirm, localhost is supposed to work with web folder. But for now you can just fix the URL manually by using localhost/web/app.php/contao/install

ghost commented 8 years ago

Comment by @leofeyer August 1st, 2016, 09:03 GMT

localhost is supposed to work with web folder

It is?

ghost commented 8 years ago

Comment by @leofeyer August 1st, 2016, 09:04 GMT

You are right. 😄

fritzmg commented 8 years ago

It is?

Yes, I already pointed that out here: https://github.com/contao/installation-bundle/issues/18#issuecomment-227702049 ;)

The original issue (#18) unfortunately wasn't fixed after all. The problem is, that an empty base URL is set here now: https://github.com/contao/installation-bundle/blob/1.1.2/src/HttpKernel/InstallationKernel.php#L121

$context = new RequestContext();
$context->fromRequest(Request::createFromGlobals());
$context->setBaseUrl('');

Since the base URL is empty, the router generates routes without /web for example. But without setting the base URL (thus leaving the default base URL), the router would generate the URL like so: /web/install.php/contao/install which is also wrong of course.

In order to fix it, the base URL would need to be set manually with the current base web path of the Request - with /install.php (the current SCRIPT_NAME) removed. But that's not a pretty solution either, I think.

leofeyer commented 8 years ago

If the /web fragment is present, we must assume that URL rewriting has not yet been configured, therefore we would need to redirect to /web/app.php/contao/install, wouldn't we?

aschempp commented 8 years ago

Shouldn't the path be automatically handled by the Symfony router or url generator?

leofeyer commented 8 years ago

I think you need to re-read the ticket. :wink:

leofeyer commented 8 years ago

Fixed in 571ae0fac73517c4575e57deec85905bfc98c1b4.

fritzmg commented 7 years ago

This is a problem again in contao/standard-edition and contao/managed-edition. Accessing http://localhost/contao4/web/install.php redirects to http://localhost/contao/install.