Very strange Drupal 7 404 behaviour

2019-05-07 23:24发布

I am having some very strange behaviour in D7 that I have not seen before. I have migrated a new site from my dev machine to a test machine, so code and DB are identical. On the dev machine (Ubuntu 13.04, Apache, PHP 5.5.3), everything works fine, but on the test box which is a Raspberry Pi running PHP 5.4.4 on Raspbian, I seem to get 404 errors on form submission. What seems to happen is that the form is not processed and the original page is returned but with a 404 status code when you look at the HTTP response.

This is affecting everything that uses POST, including login. I did manage to get it to log in by changing the 'action' attribute of the login form to point to '/' using Firefox's web developer tools, but lots of other things didn't work and the admin menu occasionally disappeared.

Thought it might be a caching issue so manually truncated all the cache tables but that made no difference. There appeared to be an issue with a non-existent temp folder so I created the one it was expecting with 777 perms (as I couldn't change the setting because form submission wouldn't work...) but it wasn't this either. Clean URLs are working fine.

Never seen anything like this before. Any ideas most appreciated!

1条回答
对你真心纯属浪费
2楼-- · 2019-05-07 23:54

Here is what seems to be the answer to this question (taken from a comment from OPer below the question):

I'd forgotten to enable mod_rewrite and mod_headers! What I was amazed about was that clean URLs were working at all without them. I think this is because .htaccess points 404s to Drupal, which will then interpret the requested URL and show the appropriate page, but of course Apache is sending a 404 header.

查看更多
登录 后发表回答