Prevent users from browsing through the media galleries
I had similar question this morning I recommended this plugin
I had similar question this morning I recommended this plugin
/wp-admin/includes/misc.php includes the function insert_with_markers() : /** * Inserts an array of strings into a file (.htaccess ), placing it between * BEGIN and END markers. * * Replaces existing marked info. Retains surrounding * data. Creates file if none exists. * * @since 1.5.0 * * @param string $filename Filename to alter. * @param … Read more
StackOverflow has already an answer for your question: https://stackoverflow.com/questions/2551553/htaccess-redirecting-dynamic-url I guess that this should do the trick: RewriteRule ^(\d+)$ /?p=$1 [R=302,L]
…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
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
As you’ve stated, the B flag is required in this case. But this should be [B,L], not [BNC] as you’ve quoted a couple of times? Not sure where you got [BNC] from, but that’s wholly invalid and would break an Apache server (500 Internal Server Error response). If you don’t see an error, using this … Read more
To reduce multiple slashes at the start of the URL-path (or in fact anywhere in the URL-path) to a single slash (there is always at least 1 slash at the start of the URL-path, even if you can’t see this is the browser’s address bar) then you can use a directive like the following: # … Read more
I just did this on a client site. I set up my rules like this: RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)fsdegrees.com [NC] RewriteRule ^(.*)$ http://www.56degrees.co.uk/$1 [R=301,L] The first rule checks the incoming domain and verifies that it is the old domain. The second sends a 301 redirect and visitors are sent to the corresponding page on … Read more
Use in your .htaccess: Options -Indexes … to disable directory listings. See the Apache manual for details. To restrict the access just to two URLs you might use: RedirectMatch 204 ^/wp-content/$ RedirectMatch 204 ^/wp-content/dir/$ 204 is the No Content response. Very fast. 🙂
The .htaccess directives block any HTTP request not coming from your IP address. However, I believe WP Cron is also an HTTP request that originates from the server. So, you need to also make an exception for the server’s external IP address. These directives can also be simplified a bit… For example: RewriteCond %{REMOTE_ADDR} !=203.0.113.111 … Read more