Where to put W3 Total Cache rewrite rules in .htaccess? [closed]
There are rewrite rules involved, so I believe the order does indeed matter. Your suggested order looks correct.
There are rewrite rules involved, so I believe the order does indeed matter. Your suggested order looks correct.
Be aware, the AJAX file admin-ajax.php is in the wp-admin directory too. So I guess your site is using AJAX to send requests in the background to the admin directory. Clicking it away lets the AJAX request fail, but the error isn’t displayed. Change the .htaccess to: AuthType Basic AuthName ‘YOUR_AUTH_NAME’ AuthUserFile PATH_TO_HTPASSWORD <Files ‘*’> … Read more
With localhost, you need to make sure that your mod_rewrite is on. You can do this in your httpd.conf file in MAMP. MAMP > CONF > APACHE > ORIGINAL > httpd.conf. Uncomment this line: LoadModule rewrite_module modules/mod_rewrite.so
More reliable will be allowing specific IP instead of domain using REMOTE_ADDR header. You can use HTTP_REFERRER header but it is not reliable. You can do it via using rest_authentication_errors filter. add_filter( ‘rest_authentication_errors’, ‘wpse150207_filter_incoming_connections’ ); function wpse150207_filter_incoming_connections( $errors ){ $allowed_ips = array( ‘127.0.0.1’ ); $request_server = $_SERVER[‘REMOTE_ADDR’]; if( ! in_array( $request_server, $allowed_ips ) ) return … Read more
You might have edited your .htaccess file in Windows notepad or text editor. If you did use Windows text editor then it must have added some special chars in .htaccess file and that will lead to 500 internal server error. Never edit in Windows text editor. Use notepad++ for editing .htaccess and .htpasswd files.
In my experience you don’t need to mess with .htaccess with a WordPress site. Just set the General Settings -> “WordPress Address” and “Site Address” to the preferred version (www or non www) and WordPress takes care of the redirection for you.
You can add a RewriteRule to your .htaccess to instruct mod_rewrite to stop processing any URI that begins with Staff/ or resolves to Staff: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteRule ^/?Staff(/|$) – [END,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> In effect, this … Read more
You need to add a rewrite rule to WordPress. There are several options to do it depending on your exact needs. Maybe the most general is using add_rewrite_tag() and add_rewrite_rule(): add_action( ‘init’, ‘cyb_rewrite_rules’ ); function cyb_rewrite_rules() { add_rewrite_tag( ‘%variable1%’, ‘([^&]+)’ ); add_rewrite_tag( ‘%variable2%’, ‘([^&]+)’ ); add_rewrite_rule( ^system/([^/]*)/([^/]*)/?’, ‘index.php?pagename=$matches[1]&variable1=$matches[2]&variable2=$matches[3]’, ‘top’ ); } Now, if the URL … Read more
Try reverting back to the default .htaccess file with the following code: # 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 If you’re using some other “flavor” of WP (e.g. multisite) view the htaccess docs on the … Read more
There are a couple of ways to do this. If you’re using a custom theme or a child theme, add (or edit) a theme file called 404.php. The contents of that file should be: <?php header(“HTTP/1.1 301 Moved Permanently”); header(“Location: “.get_bloginfo(‘url’)); exit(); ?> You can add this code as a plugin, or put it in … Read more