Htaccess rule, convert dash to slash in url

I want to convert single (first) dash into slash. I have two urls here:

Actuall url:
http://localhost/wordpress/accessories-car-alarm-system.

Read More

Should redirect to
http://localhost/wordpress/accessories/car-alarm-system.

I want to convert this specific url from first one to second one. I am using this code but it doesn’t work properly.

Whole htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
RewriteRule ^/?accessories/(.+)$ /accessories-$1 [L,NC]
</IfModule>

# END WordPress  

Tried this too:

RewriteRule ^/?accessories/(.+)$ /accessories-$1 [L,NC]

Still not working

Related posts

Leave a Reply

3 comments