0

I have a local dev site configured (Ubuntu 14.04.1 LTS), and I copied a production website to play with there. Everything appears to work great. Clean URLs seem to work and I can navigate the site. It's all wonderful... until I try to login.

When I login at /user, submitting the form returns me to the login as if nothing happened. I was able to login by visiting /?q=user .

After that, if I attempt to clear the cache under performance settings, I get a similar result where the performance page loads as if nothing happened (clearing cache manually via mysql doesn't help). If I disable clean URLs altogether, all is well.

I tried replacing the .htaccess file with Drupal's default to prevent special config issues (no effect). I didn't see anything set as $base_url in settings.php (I'll try setting that to see what happens next).

Any thoughts on why a site with clean URLs enabled seems fine until POST data is involved? Thanks for the feedback in advance!

  • update: If I visit /?q=admin/config/search/clean-urls, and run the clean URL test, it fails. If I visit /admin/config/search/clean-urls, I can see the page. However, if I check "Enable clean URLs" then submit the form, the page reloads with the form option unchecked (same issue, but interesting). By following the handbook here, so far I can confirm that .htaccess files are read if I enter a bunch of random characters (which successfully breaks any page) – Christopher Stevens Apr 1 '15 at 17:04
1

I think you need to enable Apache's rewrite module using a2enmod rewrite or with sudo if you get permission errors and added the Apache directive AllowOverride All for VirtualHost.

  • sudo a2enmod rewrite "Module rewrite already enabled", let me double check my virtual host settings but I'm pretty sure that's all set to go. I can say that my .htaccess file is being read so far... – Christopher Stevens Apr 1 '15 at 17:53
  • In /etc/apache2/apache2.conf: ... <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ... AccessFileName .htaccess ... In /etc/apache2/sites-available/000-default.conf: <VirtualHost *:80> ... DocumentRoot /var/www/html ... </VirtualHost> – Christopher Stevens Apr 1 '15 at 18:03
  • Sorry, guessing formatting is not working well in comments or I'm doing terrible pre-lunch. pastebin.com/9mByvybV – Christopher Stevens Apr 1 '15 at 18:06
  • Oh gosh! Lunch fixed it, but I'm giving you the points. ;) When I ran <?php php_info(); ?>, I did not see mod_rewrite being loaded. While I thought I was restarting apache, it kept saying "[fail]" as I wasn't using sudo... After lunch, I REALLY restarted the server from efforts early morning and all worked like a charm. – Christopher Stevens Apr 1 '15 at 20:17
  • That's good news! Great you got it working. – Leolando Tan Apr 2 '15 at 2:25
0

Try to uncomment RewriteBase / (remove #) in .htaccess file and make sure that $base_url in settings.php file is commented.

  • Thank you for your prompt response. With RewriteBase / uncommented, and $base_url commented out, I have the same results. – Christopher Stevens Apr 1 '15 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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