Remove File Extension for Page Outside of WordPress

…but that still didn’t remove the extension. To be clear, the extension should already be removed in the HTML anchor/link. The purpose of .htaccess is primarily to rewrite the extensionless URL back to the underlying filesystem path (which contains the file extension). RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] Apart from rewriting to .php, not … Read more

How have I misconfigured basic auth for my wordpress site?

Ok editing the default-ssl.conf as described here (or in my case /etc/apache2/sites-enabled/mysite.com-le-ssl.conf) to add auth settings to the end of the Virtual Host block works fine now. So it’s now: <IfModule mod_ssl.c> <VirtualHost *:443> ServerName mysite.com ServerAlias www.mysite.com ServerAdmin webmaster@localhost DocumentRoot /var/www/mysite.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/mysite.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/mysite.com/privkey.pem <Directory “/var/www/mysite.com”> … Read more

Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021

Check to see if a person is logged in: <IfModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} (.*) RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_([a-zA-Z0-9_]*) [NC] RewriteRule .* – [F,L] </IfModule> The same applies as it did 10 years ago. This code in .htaccess doesn’t have anything to do with how WordPress might be setting cookies. And this does not “check to see … Read more

What is the role of .htaccess file in WordPress?

The .htaccess file is not actually required for WordPress to “work”. However, it is required if you wish to create a more user-friendly URL structure (ie. anything other than “plain” permalinks, as Jack suggests). This is also why the default WordPress .htaccess file surrounds the directives in an <IfModule mod_rewrite.c> container. It “works” if “mod_rewrite” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)