How to make the subdomain directory redirect?

0

I have a domain lostscavenge.com.br and created a subdomain for him forum.lostscavenge.com.br that points to the forum scavenge.forumeiros.com is working right everything beauty, the problem is that if I access lostscavenge.com .br / forum it opens the empty folder of the directory in the browser, and I would like to have it redirected to forum forum.lostscavenge.com.br

What can I do to make this happen? The hosting is mine, I have general access to the cpanel and everything ...

    
asked by anonymous 24.08.2016 / 01:19

1 answer

1

Create a file named index.php and place it in the / forum root In this file, we will use the command header to redirect as below.

<?php
   header("Location: http://scavenge.forumeiros.com"); 
?>

If you want, you can also do it in html / javascript.

Create an index.html file with the following lines:

<script language="javascript">
    window.location.href = "http://scavenge.forumeiros.com";
</script>

But still if you do not want it redirected, you can create a .htaccess file within the directory in question, like the example below:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^lostscavenge.com.br/forum$
RewriteRule ^(.*)$ http://scavenge.forumeiros.com$1 [P]

In this, we will be able to keep URL , with the external content.

    
24.08.2016 / 01:25