Valet-plus: [Magento2] Admin 404 & urls include server.php/

Created on 16 Sep 2017  Â·  11Comments  Â·  Source: weprovide/valet-plus

I installed a fresh Magento 2.1 installation, but when I visit the admin URL, it get's changed to something like this: http://magento21.dev/server.php/admin_4t5lza/admin/index/index/key/f4abf7a53b0be6c9119/

Also, other links on the page include server.php, but don't actually work, unless I remove the server.php manually. Am I missing something?
Laravel project does seem to work.

1.0.x Bug HELP WANTED

Most helpful comment

php bin/magento config:set web/seo/use_rewrites 1

All 11 comments

Hey @barryvdh it's a bug I haven't looked into yet, cause the fix is simple. You need to enable web/seo/use_rewrites then it magically works. I'm expecting it to be related to the $_SERVER['SCRIPT_FILENAME'] variable. Seen a similar behaviour when I fixed the /setup route.

Ah yeah I wanted to try that, except I couldn't access the admin and didn't
know the code CLI access ;)

On Sep 16, 2017 19:03, "Tim Neutkens" notifications@github.com wrote:

Hey @barryvdh https://github.com/barryvdh it's a bug I haven't looked
into yet, cause the fix is simple. You need to enable web/seo/use_rewrites
then it magically works.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/weprovide/valet-plus/issues/66#issuecomment-329981226,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7Z1Syb7n-GdXvLJ7JBcwmdsdGAX1cCks5si_9agaJpZM4PZ0ZV
.

It did work with my old driver, but removed it because it conflicted with the one provided here. But unfortunately I don't have the old one anymore...

No worries! Will figure it out sometime 😄

php bin/magento config:set web/seo/use_rewrites 1

I'm experiencing this issue in Magento 1 admin, enabling web/seo/use_rewrites not solve this problem.

Any ideas or someone is experiencing this issue too?

Cheers

To solve in my case I needed to create a LocalValetDriver and clean $_SERVER['SCRIPT_FILENAME']

<?php

class LocalValetDriver extends MagentoValetDriver
{
    public function frontControllerPath($sitePath, $siteName, $uri)
    {
        $_SERVER['SCRIPT_FILENAME'] = 'index.php';
        return $sitePath.'/htdocs/index.php';
    }
//...

Running the command mentioned by @complexthings fixes this issue. Don't forget to clear your caches after running the command.

I think if you add $_SERVER['SCRIPT_FILENAME'] = $frontControllerPath; to server.php after the front controller path 404 check, this fixes the issue for all applications. I don't run macOS unfortunately, so I can not verify. It's basically the fix @cagartner mentions, but built into Valet+.

The solution from @complexthings helped me.

On a related note, if someone encounters this, I've had 404 even after running previously suggested command. What was happening is that /admin was redirecting to https.

I had to run php bin/magento config:set web/secure/use_in_adminhtml 0 to resolve this.

Dear Contributor,

With the release of Valet+ 2.0.0 the Valet+ development team and contributors have implemented the contribution guidelines. The contribution guidelines aim to improve the support and workflow of Valet+. For further information why this was implemented please check https://github.com/weprovide/valet-plus/issues/393.

We're closing this ticket because it does not follow the correct format. If you feel your ticket is still relevant we encourage you to re-open your ticket using the correct format.

Kind regards,
The Valet+ team

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guarinogabriel picture guarinogabriel  Â·  15Comments

stanleyyylau picture stanleyyylau  Â·  17Comments

farmaworld picture farmaworld  Â·  18Comments

sirjonathan picture sirjonathan  Â·  14Comments

capitaladot picture capitaladot  Â·  24Comments