Hello!

Previously, the blog pages went right after site.ru, i.e. site.ru/post1.html; site.ru/post2.html ...

New links are now available at site.ru/blog/post1.html links and so on.

How to register a redirect for this in htacess?

Thank!

    1 answer 1

    Try adding rewrite

    RewriteEngine On RewriteCond %{HTTP_HOST} ^site\.ru$ [NC] RewriteRule ^post(.+)/$ /blog/post$1 [R=301,L] 
    • If I'm not mistaken, it will redirect all pages, right? The problem is that in addition to the blog pages there are also ordinary ones (About us, history and the like). - Erik Vlasovs
    • Few corrected the rule. It should work if all the posts of your posts looked like site.ru/postX - Andrey Pivovarov
    • And if you independently register addresses? There are 8 of them. - Erik Vlasovs
    • Or will it be more reasonable to set up redirects in Cpanel, for example? Just the posts are named differently: / - Erik Vlasovs