Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect /index.php/* to /* in Drupal Nginx images #237

Closed
seanhamlin opened this issue Jul 27, 2020 · 3 comments
Closed

Redirect /index.php/* to /* in Drupal Nginx images #237

seanhamlin opened this issue Jul 27, 2020 · 3 comments

Comments

@seanhamlin
Copy link
Contributor

See https://www.drupal.org/forum/support/post-installation/2020-04-06/solved-drupal-8-is-adding-indexphp-in-url for background. In short, Drupal 8 has valid routes for /index.php/blah where the friendly URL is /blah. This only serves to confuse Google, and the end user.

There is best practice in https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/ to fix this with

    # Enforce clean URLs
    # Removes index.php from urls like www.example.com/index.php/my-page --> www.example.com/my-page
    # Could be done with 301 for permanent or other redirect codes.
    if ($request_uri ~* "^(.*/)index\.php/(.*)") {
        return 307 $1$2;
    }

We should add this to the base images.

@Schnitzel
Copy link
Contributor

mhh we already do something like this:
https://github.com/amazeeio/lagoon/blob/8128a4db750a61fcda62e6d5206be6c4865506e9/images/nginx-drupal/drupal.conf#L12-L14

I guess this could conflict?

@seanhamlin
Copy link
Contributor Author

seanhamlin commented Jul 27, 2020

I guess we could just update the existing rule with the recommended rule from Nginx. There was a customer that had found a bunch of URLs that were prefixed by /index.php/ in Google (so clearly the current redirect is not perfect).

@tobybellwood tobybellwood transferred this issue from uselagoon/lagoon Jun 16, 2021
@tobybellwood
Copy link
Member

Closing as no further recent conversation - please reopen if this use case or issue still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants