Redirect to specific folder as soon as user accesses domain

Asked

Viewed 156 times

0

Whenever the user accesses the site www.teste.com.br, I want it to be redirected to the folder /new. Example: www.teste.com.br/new You can do this in . php or through . htaccess?

  • 1

    There are links that use the old URL, for example www.teste.com.br/contato? If yes, what should be done when accessed?

  • There is. Two more. /products and /contact. It should open /new/products.php

1 answer

1


just use the native php function header() example:

header('Location: www.site.com/novocaminho');

or if you prefer to use . htaccess, metes in the root directory example:

Redirect 301 / http://site.com/novocaminho 
#tambem podes meter arquivos php
  • I did it, but it’s leading to test.com.br/sitesitesitesitesitesitesitesitesitesitesitesitesitesitesitesitesite - is creating several "site".

  • That one sites would be the novo which you quoted in the question? This is due to the fact that the new URL also matches the defined expression and is redirected again.

  • the site would be www.teste.com.br

  • @Exact Andersoncarloswoss, this / site is the way I want to redirect

Browser other questions tagged

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