My wordpress install is ignoring my .htaccess file. I am running Lubuntu 18.04 locally with Apache2. The root directory for localhost is at /var/www/html and my wordpress project is in that folder under /wptest2
Diagnosing the problem
- The pretty urls on my local install are all broken. Ugly urls work fine though.
- I put a breaking change towards the top of the .htaccess file and it didn't cause a 500 internal server error, it just caused a
not foundor loaded the page depending on if I enabled pretty or ugly urls.
Things I have tried
Enabling mod rewrite
$ sudo a2enmod rewrite $ systemctl restart apache2 $ rewrite module appears enabled. Problem is not fixed however.
Allowing overrides to the virtual hosts file
owner@G700:/var/www/html$ apache2ctl -S VirtualHost configuration: *:80 localhost (/etc/apache2/sites-enabled/000-default.conf:1) <continues ...> $ sudo nano /etc/apache2/sites-available/000-default.conf $ systemctl restart apache2 $ Pretty urls are still broken and the intentional breaking line in .htaccess seems to be ignored.
What else could be the issue? These are the contents of my .htaccess file at: /var/www/html/wptest2
this line should cause a 500 internal server error # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress Update
Inside folder /var/log/apache2, error.log doesn't show anything related. I see this in access.log:
::1 - - [20/Sep/2019:00:45:58 +0700] "GET /icons/text.gif HTTP/1.1" 200 512 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gec$ ::1 - - [20/Sep/2019:00:45:58 +0700] "GET /icons/unknown.gif HTTP/1.1" 200 528 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like $ ::1 - - [20/Sep/2019:00:46:05 +0700] "GET /info.php HTTP/1.1" 200 26906 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809$ ::1 - - [20/Sep/2019:01:04:48 +0700] "GET /wptest2/category/uncategorized/ HTTP/1.1" 404 488 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Ge$ ::1 - - [20/Sep/2019:01:04:50 +0700] "GET /wptest2/category/uncategorized/ HTTP/1.1" 404 487 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Ge$ ::1 - - [20/Sep/2019:01:04:51 +0700] "GET /wptest2/category/uncategorized/ HTTP/1.1" 404 487 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Ge$ ::1 - - [20/Sep/2019:01:04:52 +0700] "GET /wptest2/category/uncategorized/ HTTP/1.1" 404 487 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Ge$ ::1 - - [20/Sep/2019:01:04:54 +0700] "GET /wptest2/category/uncategorized/ HTTP/1.1" 404 487 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Ge$ That is the url I was testing on. In the browser it is broken, showing this:
Not Found The requested URL was not found on this server. I have tested a request using curl and it still shows not found:
owner@G700:/var/www/html$ curl -I HTTP/1.1 404 Not Found Date: Thu, 19 Sep 2019 19:52:33 GMT Server: Apache/2.4.29 (Ubuntu) Content-Type: text/html; charset=iso-8859-1 4 Reset to default
