P
P
Peter2016-10-09 21:00:09
htaccess
Peter, 2016-10-09 21:00:09

How to organize a redirect of a group of links?

Hello, the task is to redirect a group of links of the form:
site.ru/blog/article_slug
to:
site.ru/news/article_slug tried
like this:

RewriteCond %{REQUEST_URI} ^(.*)(\/blog\/)(\S+)$
RewriteRule /news\/%3 [R=301,L]

But nothing comes out, instead of a redirect 404 error
Full htaccess:
AddDefaultCharset utf-8
Options +FollowSymLinks
IndexIgnore */*

ServerSignature Off


<IfModule mod_rewrite.c>
    RewriteEngine on

    RedirectMatch 403 /\..*$

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule . index.php
</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2016-10-11
@denikod

Try like this (without RewriteCond):
RewriteRule ^.*/blog/([\S]+)$ /news/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question