M
M
maksimbagatov2014-01-26 08:59:16
PHP
maksimbagatov, 2014-01-26 08:59:16

How to make a redirect (go) in .htaccess to another site?

Tell me, please, how to do a redirect?
I do it like this

RewriteRule ^go/(.*) http://$1 [R=302,NC,L]
<a href="/go/https://www.change.org/ru/"></a>
,
but I would like it to pass from all cases
<a href="/go/https://www.change.org/ru/"></a>
<a href="/go/change.org/ru/"></a>
<a href="/go/http://change.org/ru/"></a>

but it goes like this https/www.change.org/ru/, that is, somehow you need to take into account the protocol (%{THE_REQUEST})
How to make a redirect so that it works with the protocol (http or https) and without it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akashtrih, 2014-01-26
@maksimbagatov

RewriteRule ^go/(https?):/(.*)$ $1://$2 [R=302,NC,L]
RewriteRule ^go/(.*)$ http://$1 [R=302,NC,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question