M
M
Magzhan Birgebayuly2015-11-20 18:42:58
htaccess
Magzhan Birgebayuly, 2015-11-20 18:42:58

How to write correct rule for RedirectMatch in .htaccess?

It is necessary that requests for the /pages/ directory be redirected to the main page.
This way: RedirectMatch 301 ^/pages/*/$ /it only works if you go to the /pages directory, and then /pages/in the rule stops working...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-11-21
@ShamblerR

RewriteCond %{REQUEST_URI} ^(.*)/dir1/(.*)$
# if string contains /dir1/
RewriteRule ^(.*)$ %1/dir2/%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