Restricting user login by IP address

IP address validation during authentication – for a selected user only Here’s a way to hook into the authenticate filter and validate the IP address for a given user during authentication. The user can see the invalid IP address error like shown here: /** * Validate IP Address During Authentication – For A Given User … Read more

WildCard SSL with wordpress subdomain

I found a simple plugin that did the job for me. This is what my .htaccess file looks like now for my sub-domain: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTPS} !=on [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # BEGIN WordPress #RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php … Read more

htaccess redirects and WordPress

The standard WordPress .htaccess file will do this for you if you select one of the “pretty permalinks” in the Settings / Permalinks page, like the “posts” option. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress … Read more

Wrong wp-admin URL

Eventually, I found the reason of this weird behaviour. It is caused by the JavaScript embedded in wp_admin_canonical_url() (https://developer.wordpress.org/reference/functions/wp_admin_canonical_url/) The URL is determined by this piece of code $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’] where the latter one returns wp-admin instead of hello/wp-admin. By manipulating the value in $_SERVER[‘REQUEST_URI’], I can successfully get the correct behaviour in admin … Read more

Create rewriterules for different domains in htaccess file with WP multisite

If you wanted to target a specific domain then you need a condition (RewriteCond directive), preceding the RewriteRule that checks for the specific domain (Host: header). For example: RewriteCond %{HTTP_HOST} ^domainb\.com [NC] RewriteRule ^i-like-([a-zA-Z0-9-]+)/$ wp-content/themes/customtheme/custom-pages/ilike.php?like=$1 [L] The HTTP_HOST server variable contains just the Host: header sent in the request. Reference: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond

Why does chrome keep downloading a file instead of running the site?

What I do On receipt of WordPress files and Db install in my localhost directory (I use EasyPHP Dev server) I then install Db and change wp-config.php to connect to local db etc. Then copy .htacces to htaccess.back Edit .htaccess to point at local dir structure (in this case find “~porterp6” and replace with “wordpress2” … Read more

Use htaccess to redirect WordPress to static website in a subfolder

If you want an external redirect from /2016/<anything> to /2016/a/<anything>, then you can do something like the following before the existing WordPress directives (ie. before # BEGIN WordPress) in your /2016/.htaccess file: RewriteCond %{REQUEST_URI} ^/(\d{4})/(.*) RewriteRule !^a/ /%1/a/%2 [R,L] The negated RewriteRule pattern prevents the redirect from occurring when the URl-path already starts with a/ … Read more

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