0

We are running Drupal 7 on NGINX. The config has worked fine except that path aliases are ignored. When we navigate there, we get a "file not found" page instead of a redirection to the node.

Clean URLs work fine -- the site navigation using clean URLs works perfectly. It's just the aliases that are not working. We used this config example as the basis for the setup: https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/

Any ideas on what we're missing?

2
  • 1
    Can you please specify the difference between the above mentioned perfectly working 'clean URLs' and the not working 'path aliases'? Probably adding your nginx config would help as well. You wrote about using the example as basis. So what changes did you make to it? Commented Jan 24, 2018 at 10:58
  • Clean URLs work -- as in, you can access pages through clean paths rather than index.php?q=path -- menu items are accessible via the clean paths. The core Drupal URL aliases tool does not work. When creating an alias pair and visiting the alias, it renders a file not found page rather than redirecting to the desired destination. So the issue is not with clean paths, but with redirection. We implemented that sample site config exactly as presented (obviously plugging in our own domain and paths for the placeholders). Commented Jan 24, 2018 at 13:52

1 Answer 1

1

If you just add the following snippet under -> location ~ '.php$|^/update.php' {

#Redirect urls with php extension
if ($request_uri ~ .*.php.*) {
        error_page 404 =  @rewrite;
}

that should get it to work! It's basically telling nginx how to handle urls with .php extension.

And then restart nginx

sudo service nginx restart

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.