Htaccess redirect from ‘/%postname%.html’ to ‘/%postname%’

Above the WordPress rewrite rules add: RedirectMatch permanent ^/([^/]+)\.html$ /$1 That will catch example.com/foo.html but not example.com/travel-guides/foo.html. To catch all URLs ending with .html remove the first ^ from the pattern. To redirect all URLs ending with .html except those in travel-guides you need mod_rewrite: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/travel-guides/ RewriteRule ([^/]+)\.html$ /$1 … Read more

How to setup 301 redirects for multiple query string URLs?

From doing some research, I’d recommend trying out this plugin: Redirection. This plugin allows you to manage 301 redirections. I played around with the settings and they allows regular expressions which could do the following: http://some.site/hashtag?tag=some-tag/ to http://some.site/tags/some-tag/ They provide documentation on how to set it up which can be found here. This is what … Read more

Exclude a path from WordPress using .htaccess redirects (Apache)

One small hiccup is that you’ll need to update RewriteRule ./ in that second to last line. Here is an updated (and tested) snippet for you: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_URI} !^/foo/.*$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ./ /index.php [L] </IfModule> # END … Read more

Redirect After Delete User in Backend

You could also do this, function mod_redirect_subscriber_delete($user_id) { $user = get_user_by(‘id’, $user_id); $role = $user->roles[0]; if ($role == ‘subscriber’) { add_action(“deleted_user”, function(){ wp_redirect( admin_url(‘/index.php’) ); exit; }); } } add_action(“delete_user”, “mod_redirect_subscriber_delete”); Anonymous functions (closures), available in PHP 5.3+. Benefits: No need to remove the initial hook on delete_user No need to re-run wp_delete_user() You still … Read more

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