Martin Myška Martin Myška - 3 months ago 7
PHP Question

.htaccess redirect from old Joomla to Wordpress

im in trouble with redirect from my old Joomla to newer Wordpress site.
Website site is for example www.thatsme.cz, but when i want to load this old URL from Joomla

http://thatsme.cz/bydleni-a-zahrada/756-jak-poznat-zkusenou-firmu


Wordpress shows me 404 error, how can i redirect it so new URL will be

http://thatsme.cz/jak-poznat-zkusenou-firmu


I want to redirect more sites, so its little bit harder, i need just to remove category (bydleni-a-zahrada) and first numbers after "/" with "-".
That is all

EDIT:
My .htaccess file looks this:

# 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

Answer

You can use this redirect rule as your very first rule:

RedirectMatch 301 ^/[^/]+/\d+-(.+)$ /$1
Comments