I am trying to add a rule to wordpress so that anything like /src/test becomes /src?urn=test with the following rule.
add_action('init', 'add_src_url');
function add_src_url()
{
add_rewrite_rule(
'^src/([^/]*)$',
'src/urn=$matches[1]',
'top'
);
}
Content of .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The above is not working. Mod Rewrite is enable. Is there any problem with the code ?
Try like below and let me know: