WordPress ignores .htaccess
-
Hello!
Please help who knows how.
We have a URL product:
https://example.com/public/admin/en/product/product_name/We need to get this page by URL with the city of Rome, without a redirect:
https://example.com/public/admin/en/rome/product/product_name/For this, an entry was made in .htaccess, before the WordPress rules:
RewriteBase /public/admin/ RewriteRule ^(en/product/)([^/]+)/(.+)$ https://example.com/public/admin/$1$3?city=$2 [L,QSA]WP ignores .htaccess and redirects to:
https://example.com/public/admin/en/product/product_name/?city=romeHad no effect:
1. plugin https://ww.wp.xz.cn/plugins/disable-url-autocorrect-guessing/
2. Code:
add_filter( 'redirect_canonical', 'custom_redirect_canonical', 10, 2 ); function custom_redirect_canonical( $redirect_url, $requested_url ) { if( $requested_url == 'https://...' ) { return $requested_url; } return $redirect_url; }3. Code:
remove_action('template_redirect', 'redirect_canonical');
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘WordPress ignores .htaccess’ is closed to new replies.