Method 1: Intervening in file functions.php
in your functions.php file and add this code in, or you can attach it to a file of that plugin:
function fix_slash( $string, $type ) { global $wp_rewrite; if ( $wp_rewrite->use_trailing_slashes == false ) { if ( $type != 'single' && $type != 'category' ) return trailingslashit( $string ); if ( $type == 'single' && ( strpos( $string, '.html/' ) !== false ) ) return trailingslashit( $string ); if ( $type == 'category' && ( strpos( $string, 'category' ) !== false ) ) { $aa_g = str_replace( "/category/", "/", $string ); return trailingslashit( $aa_g ); } if ( $type == 'category' ) return trailingslashit( $string ); } return $string; } add_filter( 'user_trailingslashit', 'fix_slash', 55, 2 );
Method 2: Use. Htaccess to navigate
Myself to always use this method for handling / category / because if one can use a will cause a number of issues affecting the code of the website. Moreover. Htaccess should use 301 redirects can fully apply to all sites, whether new or old.
Add the following code into the file. Htaccess with following code:
RedirectMatch 301 ^/category/(.+)$ http://www.webmastersun .com/$1 # OR RewriteRule ^category/(.+)$ http://www.webmastersun.com/$1 [R=301,L]
No comments:
Post a Comment