1

I need to make the following redirection using htaccess (WordPress)

http://oldweb.com/pl/

to https://newweb.com/url/differenturl/

But this redirection should work only for http://oldweb.com/pl/, the urls http://oldweb.com/en/ or http://oldweb.com/il/ should not have any redirection.

My solution works but it works for /en/ and /il/ also:

Redirect 301 http://oldweb.com/pl/ https://newweb.com/url/differenturl/

I'm not a hero in rewriting, sorry :) Can anyone help me with this simple thing?

1 Answer 1

1

Redirect matches only REQUEST_URI not full URL with domain protocol etc.

Better to use a RewriteRule just below RewriteEngine On line in your root .htaccess:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?oldweb\.com$ [NC]
RewriteRule ^pl/?$ https://newweb.com/url/differenturl/ [L,NC,R=301]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.