How can I redirect a request to the site root using htaccess, if there’s not a specific cookie set?

if the cookie “language_known” isn’t set to the value “yes”. RewriteCond %{HTTP_COOKIE} !language_known=true;? [NC] The condition is checking that the value is not “true” (string), not “yes”? However, the rule is also configured as a 301 (permanent) redirect, so this will be cached persistently by the browser. If the browser has redirected once, when the … Read more

fix 302 redirection error on https

First, you should not customize anything between # BEGIN WordPress and # END WordPress, it’s just not a good practice. You should add your own rules above WP rules. And you should also make use of some flags, like “L”. # BEGIN Custom <IfModule mod_rewrite.c> Options All -Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTPS} !on … Read more

How to rewrite wordpress search to work on specific category

You can use add_rewrite_rule(): add_action( ‘init’, function(){ // Non-paged requests. E.g. example.com/categoryname/search/keyword/ add_rewrite_rule( ‘^categoryname/search/([^/]+)/?$’, ‘index.php?category=categoryname&s=$matches[1]’, ‘top’ ); // For paged requests. E.g. example.com/categoryname/search/keyword/page/2/ add_rewrite_rule( ‘^categoryname/search/([^/]+)/page/(\d+)/?$’, ‘index.php?category=categoryname&s=$matches[1]&paged=$matches[2]’, ‘top’ ); } ); Be sure to flush the permalinks — simply visit the Permalink Settings page.

Seo Friendly Filter URLs

Yes, it is possible. Option 1: Programmatically using add_rewrite_rule() Add the rewrite rule: /* The rule matches: * example.com/product-category/rings/rings-in-gold/ * example.com/product-category/rings/rings-in-gold/page/<number>/ */ add_action( ‘init’, function () { add_rewrite_rule( ‘^product-category/rings/rings-in-gold(?:/page/(\d+)|)/?$’, // $matches[1] is the (\d+) (page number) from the above Regex, if any. ‘index.php?product_cat=rings&filter_material=gold&paged=$matches[1]’, ‘top’ ); } ); For other categories, just copy the above add_rewrite_rule() … Read more

How do I write a subdomain redirect?

Found answer here, first result by searching redirect to different domain apache htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^example.au$ [OR] RewriteCond %{HTTP_HOST} ^www.example.au$ RewriteRule (.*)$ http://www.example.com/$1 [R=301,L] </IfModule> It doesn’t matter if just your TLD is different the same format will work

301 redirect any RSS feed on level up url

So to redirect /en/shipper/feed/ to /en/shipper you should be able to add this in your root .htaccess. You’ll have to make sure you put it in the right place so that it gets matched before any other Rewrite rules – putting it at the top of the list of RewriteRule’s should be fine. These rules … Read more