S
S
speculant2019-04-18 22:55:41
htaccess
speculant, 2019-04-18 22:55:41

Wordpress and rewrite_rule, why doesn't the .htaccess rule work?

There is a rule in functions.php, it works but doesn't make any changes to .htaccess

add_action( 'init', 'do_rewrite', 10, 0);
function do_rewrite(){
    add_rewrite_rule(
        'profile/(\w+)/?$',
        'index.php?pagename=profile&property_id=$matches[1]',
        'top' );
}

Tried to remove it from functions and write it to .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^profile/(\w+)/?$ /index.php?pagename=profile&property_id=$matches[1] [L]
</IfModule>

But then it does not work, what am I doing wrong
* the rule when going to site.ru/profile/nickname/ uses the profile.php template

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question