How to redirect url with htaccess out of the domain?

Asked

Viewed 168 times

1

I own a domain www.dominio.com.br.

On a given page, I need to put a link to the customer’s google+ . I’m using:

a href="www.google.com" target="_blank"

For testing, and what is happening is that instead of the system opening a new tab with the address www.google.com he’s trying to redirect into my domain (www.dominio.com.br/www.google.com)

Does anyone know how I can fix this?

4 answers

1


Just change your property href for href="http://www.google.com"

0

friend, will you only direct a page? Wouldn’t it be simpler to use a redirect via PHP, for example?

<?php header("Location: http://www.site_a_ser_redirecionado.com"); ?>
  • It might be, but I thought it was simpler to do by the href tag as it was a simple link

0

Hey, try it like this:

RewriteEngine On
RewriteBase /
RewriteRule ^/?$ http\:\/\/plus\.google\.com\/+Coca-Cola\/

Note: Bring the URL always escaping with a backslash ( ) the ":", ".", "/"

  • Ah, is it a link? You forgot to put "http://" before www.

  • It worked, thank you.

0

You don’t need to use any language server-side for this, just add the protocol http or https before:

<a href="http://www.google.com" target="_blank">

SSL authentication error often occurs by not using the correct protocol, so you can omit the protocol and add only //, leaving the server to redirect to the correct protocol:

<a href="//www.google.com" target="_blank">
  • It worked, thank you.

  • @Victorgazotti that good, if the answer was useful to it mark as accepted, to indicate that the question was closed. If you think you deserve to give a vote in favor as well. ;)

  • Thank you, unfortunately I can not vote for it because I have no reputation for it =/ sorry

Browser other questions tagged

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