NGINX rewrite rules for sub subdomains

No, sorry, that isn’t going to be possible. Assuming the user connects to your server at https://www.sub.domain.com with HTTPS, the sequence of events will be: the user’s client makes a connection and initiates an SSL negotiation; they will send SNI (= server name indication) that they’re connecting to www.sub.domain.com the server can use the SNI … 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

WordPress blog posts permalinks giving 404 on nginx

You should use the ^~ prefix on the location statement, change the alias statement to root /var/www;, and change the last parameter of the try_files statement. For example: location ^~ /blog/ { autoindex on; root /var/www; index index.php; try_files $uri $uri/ /blog/index.php?$args; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; } }

Permalinks for custom taxonomy stopped to work

Sometimes a plugin changes WordPress’ internal rewrite rules during an update, an installation or deactivation. If the plugin’s update happens to run after your taxonomy registration it may just wipe out the custom rules for the taxonomy. To inspect the currently active rewrite rules use the plugin Monkeyman Rewrite Analyzer. See this answer for details. … Read more

W3 Total Cache – Converting Apache rewrites to Nginx [closed]

Based on your comment, here’s the solution for an Nginx-Apache stack with “disk: enhanced” page cache method in W3 Total Cache plugin… location / { error_page 418 = @cachemiss; recursive_error_pages on; if ($request_method = POST) { return 418; } if ($query_string != “”) { return 418; } if ($request_uri ~* “(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)”) { return 418; } … Read more

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