Removing rules from .htaccess

Problem 1 Your hook ci_add_rules() will still run when you flush rules, so remove it first (and avoid “unsetting” non_wp_rules, you’ll break other plugins that make use of it). function ci_remove_rules() { remove_action( ‘generate_rewrite_rules’, ‘ci_add_rules’ ); $GLOBALS[‘wp_rewrite’]->flush_rules(); } Problem 2 Pretty sure you want: plugin_dir_url( ‘proxy.php’, __FILE__ ) ..instead of: plugin_dir_path( __FILE__ ) . ‘proxy.php

Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions

NOTE: WordPress Rewrite API is not the same as Apache Rewrite module. WP Rewrite API doesn’t redirect a request to another URL, it used to parse current URL and fill query_vars array. The issue is in the second parameter of you add_rewrite_rule function call. It has to start from index.php? and then there should be … Read more

Multisite wordpress and subdomain URL collisions

You could just prevent slugs matching existing directories. There are two filters for that. Example, not tested: add_filter( ‘wp_unique_post_slug_is_bad_hierarchical_slug’, ‘prevent_directory_slugs’, 10, 2 ); add_filter( ‘wp_unique_post_slug_is_bad_flat_slug’, ‘prevent_directory_slugs’, 10, 2 ); function prevent_directory_slugs( $bool, $slug ) { return is_dir( ABSPATH . “https://wordpress.stackexchange.com/” . $slug ); }

Admin-Ajax.php, SSL, Non-SSL

I would recommend to define this constant in your wp-config.php to force HTTPS on admin: define(‘FORCE_SSL_ADMIN’, true); Also, there is a function called is_admin() which could be helpful in your case. if ( is_admin() ) { $_SERVER[‘HTTPS’] = ‘on’; } However, if you have a rule in your web server forcing all wp-admin and wp-login.php … Read more

Custom rewrite rules are sending everything to index.php

Finally figured it out. 1) I was calling the first function at ‘rewrite_rules_array’ instead of ‘init’ which was just dumb. 2) There was still something wrong with it, but I explored another area that seems obvious now, but which I originally glossed over because it seemed to be. https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ Just make an endpoint. WordPress … Read more

Bypass .htaccess when using download_url

You can inject a made-up referer into WordPress’ HTTP request by filtering pre_http_request. All you need is a simple class like this (untested!): class FakeWpReferer { private $referer; private $url; private $is_regex; /** * @param string $referer * @param string $url URL to fake the referer for. * @param bool $is_regex Is $url a regular … Read more

302 redirect instead of 301 after switch to HTTPS

RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.janjippe.nl/$1 [R,L] Your “old” .htaccess file at /public_html/.htaccess would appear to have the suspect 302 redirect. Without an explicit status code, the R flag defaults to a 302. If the entire site has been moved to the /private_html folder as part of the implementation of SSL then it would seem … Read more

Remove year and month in URL using .htaccess

Assuming you have already changed the permalinks structure as @RickHellewell suggests, then you can do something like the following near the top of your .htaccess file (before the existing WP front-controller) to redirect the old URLs (with the stated format) in order to preserve SEO. RewriteRule ^\d{4}/\d\d/([a-z-]+\.html)$ /$1 [R=301,L]

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