1

This is occuring on my local machine, Lubuntu 18.04 with apache2 and Php 7.2.15.

Steps tried:

  1. Enable hidden files

No .htaccess file seen:

https://nimb.ws/4YJfDT

  1. Switch permalink structure to attempt to force Wordpress to create new .htaccess file (if missing). Reload file manager.

No change.

https://nimb.ws/eVkKb3

  1. run terminal command whereis .htaccess

Many folders listed but none in the target ( /var/www/html/wptest2/ ). There is nothing even inside /var below:

owner@G700:~$ whereis .htaccess
: /usr/bin/. /usr/sbin/. /lib/x86_64-linux-gnu/. /usr/lib/x86_64-linux-gnu/. 
/usr/lib/. /bin/. /sbin/. /etc/. /etc/.java /lib/. /lib64/. /usr/games/. /usr/local/bin/. 
/usr/local/sbin/. /usr/local/etc/. /usr/local/lib/. /usr/local/games/. /usr/include/. 
/usr/local/. /usr/libexec/. /usr/share/. /opt/emby-server/bin/. 
/opt/dmmediaconverter/bin/. /opt/wine-stable/bin/. /opt/calibre/bin/. 
/home/owner/.nvm/versions/node/v12.4.0/bin/. /home/owner/.local/bin/. 
/snap/bin/. /usr/share/man/man4/. /usr/share/man/fi/. /usr/share/man/pl/. 
/usr/share/man/id/. /usr/share/man/pt_BR/. /usr/share/man/man6/. 
/usr/share/man/ja/. /usr/share/man/hr/. /usr/share/man/sv/. 
/usr/share/man/hu/. /usr/share/man/man1/. /usr/share/man/fr.ISO8859-1/. 
/usr/share/man/zh_CN/. /usr/share/man/man5/. /usr/share/man/zh_TW/. 
/usr/share/man/man8/. /usr/share/man/ca/. /usr/share/man/man3/. 
/usr/share/man/es/. /usr/share/man/nl/. /usr/share/man/da/. 
/usr/share/man/it/. /usr/share/man/uk/. /usr/share/man/ko/. 
/usr/share/man/fr.UTF-8/. /usr/share/man/sl/. /usr/share/man/man2/. 
/usr/share/man/pt/. /usr/share/man/de/. /usr/share/man/de.UTF-8/. 
/usr/share/man/cs/. /usr/share/man/sr/. /usr/share/man/man7/. 
/usr/share/man/fr/. /usr/share/man/pl.UTF-8/. /usr/share/man/vi/. 
/usr/share/man/ru/. /usr/share/man/tr/. /usr/share/info/. /usr/src/bcmwl-
6.30.223.271+bdcom/. /usr/src/linux-headers-4.15.0-58-
generic/.tmp_versions /usr/src/linux-headers-4.15.0-58-generic/.config 
/usr/src/linux-headers-4.15.0-58-generic/. /usr/src/linux-headers-4.15.0-
58/. /usr/src/linux-headers-4.15.0-62-generic/.tmp_versions 
/usr/src/linux-headers-4.15.0-62-generic/.config /usr/src/linux-headers-
4.15.0-62-generic/. /usr/src/linux-headers-4.15.0-62/.

Any ideas what's going on here? The wordpress install fully works. I can access the back end, create posts and pages, navigate across the front end including clicking on links to new pages etc. I have developing a plugin on this side for months. But the .htaccess file seems not to exist.

If someone advises me to simply manually create an .htaccess file my followup question becomes, how can I verify that wordpress uses it? I need this file to enter some rules mandated by a JWT/Rest Api plugin.

Update

I added the following .htaccess file code to a fresh file at /var/www/html/wptest2/

https://wordpress.org/support/article/htaccess/

iersn // meant to causing a breaking change. But doesn't

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Wordpress does not break from the line above.

That said my install has always been on ugly links as pretty links cause not-found errors. I believe I don't have that properly setup and I'm sure this .htaccess issue is a contributor.

2 Answers 2

1

whereis is not the right tool to find a file.

whereis - locate the binary, source, and manual page files for a command

You better use find /var/www/html/wptest2/ -name .htaccess to search for your .htaccess.
Try to create a new .htaccess (touch /var/www/html/wptest2/.htaccess) and see if it's possible.

2
  • I get this in terminal: /var/www/html/wptest2/ -name .htaccess bash: /var/www/html/wptest2/: Is a directory
    – Sean D
    Sep 19, 2019 at 15:58
  • Yes I was able to make a blank .htaccess file that the wp install folder
    – Sean D
    Sep 19, 2019 at 16:00
1

It doesn't appear to be there but in terminal change to your wp root directory and list contents with the -la flag.

cd /var/www/html/wptest2/
ls -la

If needed, create a new .htaccess file from https://wordpress.org/support/article/htaccess/ or dl WordPress and copy the file over.

Once you know it's in place, you can simply break it to make sure it is being used--add a line 'yes i like tacos' or something.

If your htaccess file is present and not used, it could be your virtual hosts config. Make sure that host has the AllowOverride All directive.

 <VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot "/usr/docs/dummy-host.example.com"
     ServerName dummy-host.example.com
     ServerAlias www.dummy-host.example.com
    <Directory "/usr/docs/dummy-host.example.com">
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
     ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
     CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
 </VirtualHost>
2
  • I added a line of garbled text towards the top of the .htaccess file, with the wordpress rules below it. But it did not break so I guess it is not being used
    – Sean D
    Sep 19, 2019 at 16:04
  • 1
    in that case, you may need to edit your virtual hosts configuration to include the AllowOverride All directive and restart apache.
    – C0c0b33f
    Sep 19, 2019 at 18:15

Your Answer

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

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