MonteCristo
MonteCristo

Reputation: 1550

rewrite/redirect specific word from url .htaccess

I have couple of urls which is generated by wordpress/php

how can I rewrite/redirect any url with -2 to the one without? The result should be

This is what I have so far

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

Thanks

Upvotes: 4

Views: 1031

Answers (1)

Oussama Jilal
Oussama Jilal

Reputation: 7739

Add this to you htaccess :

RewriteRule ^(.*)-2(.*)$ /$1$2 [NC,L,R=301]

Upvotes: 2

Related Questions