user995195
user995195

Reputation: 15

.htaccess how to use RedirectMatch

Since I changed the structure of my website, some of the links became broken. What rule should I write in .htaccess to fix the problem.

before it was like this

/news/194-kozyrnyj-vecher-premier-ligi.html

and now it looks like this

/news/2-news/194-kozyrnyj-vecher-premier-ligi.html

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
RewriteCond %{REQUEST_URI} !^/news/2-news/(.*)
RewriteRule ^news/(.*)$ /news/2-news/$1 [R=permanent,L]

Upvotes: 0

Views: 207

Answers (1)

GriffinHeart
GriffinHeart

Reputation: 450

should be:

RewriteCond %{REQUEST_URI} !^/news/2-news/(.*)
RewriteRule ^news/(.*)$ /news/2-news/$1 [R=permanent,L]

in your .htaccess file

Upvotes: 1

Related Questions