URL and PORT forwarding in . htaccess

Asked

Viewed 613 times

0

Following,
I have a URL: http://ip_do_server/fop2
What I wanted to do is, when someone enters this url, apache redirects to the following address: http://ip_do_server:81/mesa_contact/login
I’ve tried several things including looked at other issues from here in the community, but always bump into the fact that the door is different...
Is there any way to do this using htaccess?

1 answer

1


RewriteEngine On
RewriteBase /

#Se a porta é 80
#E a URL é /fop2 ou /fop2/
#redirecionar para a nova URL
RewriteCond  %{SERVER_PORT} =80
RewriteRule  ^fop2/?$       http://ip_do_servidor:81/mesa_atendimento/login    [NC,QSA,R,L]

#                                 Flags    [NC]  :: ignorar caixa alta/baixa
#                                          [QSA] :: adicionar parâmetros se há na consulta
#                                          [R]   :: redirecionar (não reescrever)
#                                          [L]   :: parar o processamento de outras regras
  • Cara didn’t work. His logic is apparently right, but remember that in the browsers the default port is 80, so they don’t stay in the url. that can’t be why?

  • Port does not need to be in URL. %{SERVER_PORT} is a server variable with the correct port. I’m sure it works. I uploaded it to a free hosting on http://mariano.uphero.com/260627/fop2 if you want to test it. You have other lines on your . htaccess?

  • Next, your logic is right yes, I read a little about the operation of . htaccess and really what you did should work. Only that my apache works with different ports/applications, it turns out that it has mta configuration in it, probably I’m not able to use . htaccess for lack of putting some extra conf on the part of the sites-enabled, etc.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.