Project

General

Profile

Drupal 8 + Lighttpd some pages throwing 404 error because of URL rewriting

Added by evenvision over 5 years ago

We are working on setting up our Drupal 8 server, and are running into an issue with clean URLs. We are using URL rewrite rules to handle clean URLs, but this is creating an issue because some D8 URLs contain '.'. So, for example, editing a content type's field results in 'node.webform.body' at the end of the URL. Our site is reading that as a file, and is then throwing a 404 error.

Do we need to handle clean URLs in a different manner, or is there an update we can make to the rewrite rules?

We are running:

Lighttpd 1.4.49 on Linux

Drupal 8.5.6

We have the following in our lighttpd.conf:

    url.rewrite-final = (
      "^/web/system/test/(.*)$" => "/web/index.php?q=system/test/$1",
      "^/web/([^.?]*)\?(.*)$" => "/web/index.php?q=$1&$2",
      "^/web/([^.?]*)$" => "/web/index.php?q=$1",
       "^/web/rss.xml" => "/web/index.php?q=rss.xml" 
    )

Replies (1)

RE: Drupal 8 + Lighttpd some pages throwing 404 error because of URL rewriting - Added by evenvision over 5 years ago

Here is what we ended up doing:
We added the following rewrite rules to url.rewrite-final. These take care of all cases
of 404s that we have come across so far.

    "^/web/([^.?]*node.*)$" => "/web/index.php?q=$1",
    "^/web/((.*)[\.]+(.*)\/edit)$" => "/web/index.php?q=$1",
    "^/web/((.*)[\.]+(.*)[\.]+(.*))$" => "/web/index.php?q=$1",
    "^/web/([^.?]*manage\/.*[\.].*)$" => "web/index.php?q=$1" 

We are concerned about coming across more 404s, though, that are not covered by these rules. So, if anyone has any ideas on a better solution, please let me know.

    (1-1/1)