V
V
Vladislav Yavdoshchuk2021-01-29 14:48:41
htaccess
Vladislav Yavdoshchuk, 2021-01-29 14:48:41

How to remove a word from a link?

There is a link like web.net/users/vasya

It should be web.net/vasya

I do it like this
RedirectMatch /business/(.*)$ https://**.website/$1 The

redirect goes through and a 404 error pops up.

If there is an option not .htaccess too I can consider.

word press

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NIkita Bykov, 2021-01-29
@v210402

// Код добавить в файл functions.php
function true_post_type_rewrite() {
    global $wp_rewrite;
    $wp_rewrite->add_rewrite_tag("%users%", '([^/]+)', "users=");
    $wp_rewrite->add_permastruct('users', '%users%' );
}
add_action( 'init', 'true_post_type_rewrite');

function true_rewrite_conflicts( $request ) {
    if(!is_admin())
        $request['post_type'] = array('users');
    return $request;
}
add_filter( 'request',  'true_rewrite_conflicts' );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question