Htaccess redirect after changing Language URL format

In order to catch either lang=en or lang=ru you can change those directives like this: RewriteCond %{QUERY_STRING} lang=(en|ru) # exclude all requests starting with /wp-admin/ RewriteCond %{REQUEST_URI} !^/wp-admin/ RewriteRule (.*) /%1/$1? [L,R=302] The (en|ru) part matches either en or ru and the surrounding parentheses make this a capturing group that can be referenced later. The … Read more

Transfer to HTTPS – mixed content on main page only [closed]

You appear to be lazy-loading responsive images, so whether the insecure images load (or rather “blocked”) is dependent on screen size. You have many data-srcset attributes that reference http:// – these also appear to reference your non-canonical “domain apex” (ie. example.com), as opposed to the canonical hostname with a www subdomain (ie. www.example.com), so these … Read more

How to ignore folder in site root while accessing a URL

Ordinarily, requests for physical directories (and files) are not routed to WordPress. You could make an exception for this one folder (or URL) and specifically rewrite requests for /connect to index.php (the WordPress front-controller). Try the following before the # BEGIN WordPress section: # Override directory RewriteRule ^connect index.php [L]

Case insensitive header params for API request

This would seem to be a “fault” of the way WordPress (the “server”) is reading the HTTP request headers. (If they are being read into an associative array without any normalisation then the comparison will naturally be case-sensitive.) This should arguably be “fixed” in WP. However, it’s possible to create a “workaround” in .htaccess and … Read more

redirect the homepage using .htaccess outside of WordPress

As @JacobPeattie suggested in comments: If you just add index.html to the root of your WordPress installation that should become the homepage. This does, however, require that the DirectoryIndex is set appropriately. For example: DirectoryIndex index.html The DirectoryIndex is the document that Apache tries to serve when you request a directory. In this case, the … Read more

Redirect http to https does not work on subdir where another instance of WordPress installed

I think the directive in .htaccess is inherited by subfolder The mod_rewrite directives in the root .htaccess file are not inherited by the /blog/.htaccess file (by default). You would need to specifically enable mod_rewrite inheritance, however, this probably adds unnecessary complexity. I try to modify the .htaccess under /blogs/ by adding the above directive again. … Read more

WordPress: Adding Security

Yes, basically debug.log, but without deny, with 404 Yes, that directive will serve a “404 Not Found” when attempting to request debug.log. |log? However, because of the ? in the above regex, it will also block debug.lo. Is that intentional? In fact, if that is intentional then you could simply remove the g? part – … Read more

Restrict uploaded files into a custom folder to logged in users by htaccess: looking for Nginx – not only Apache – solution

The nginx equivalent of RewriteCond %{REQUEST_URI} ^.*wp-content/uploads/restricted/.* RewriteRule ^wp-content/uploads/(restricted/.*)$ dl.php?file=$1 [QSA,L] will be the location ~ ^/wp-content/uploads/(?<file>restricted/.*) { rewrite ^ /dl.php?file=$file last; } If you want to apply this to several folders under /wp-content/uploads, use location ~ ^/wp-content/uploads/(?<file>(?:restricted1|restricted2|restricted3)/.*) { rewrite ^ /dl.php?file=$file last; } I don’t think there can be any other solution for nginx … Read more