Help - Search - Members - Calendar
Full Version: Direct Visitors To Forum Address
Zymic Webmaster Forums > Web Design & Development > Client Side Scripting > HTML and CSS
kiepfeubac
is there a code to put in index.html to direct visitors to forum page when they type www.zymic.com instead www.zymic.com/forum ?
pls help.. thx
Banjo
If it's for your site then there are a few ways you can do it.

1) Meta Refresh Tag

CODE
<meta http-equiv="refresh" content="0;url=http://www.mysite.com/forum">


Just place that code in your page, the number 0 is how many seconds it should take until it redirects to new page.

2) Javascript

CODE
<script type="text/javascript">
<!--
window.location = "http://www.mysite.com/forum"
//-->
</script>


3) PHP

CODE
<?php

$URL="http://www.mysite.com/forum";

header ("Location: $URL");

?>


Im sure there are other ways, these are just a few.
uncled1023
yea, i use the javascript code, and it works fine.
Jetteh22
I also use the javascript code to redirect. It's the easiest IMO as PHP's header function you can't use if you've already put stuff in the pages headers (or something.. it only worked for me on half my pages)
Banjo
Use meta tag then.
MrTouz
I do not know if a user has his Javascript disabled on the PC if the JS code will work. I am afraid not. So the redirect will not work.

PHP, i do not think you can control time with it.

For me the Meta is simple and is the one i am sure it'll work.
Ed
If using apache, use .htaccess, it's a much cleaner redirect:

CODE
Redirect 301 / http://www.yoursite.com/forum


You could use rewrite so your forum would actually be within your domain, though if you were wanting to do that, you should just move all your forum files to the root of your website.
PDNWorkshop
If you are using phpBB3 I would advise simply moving the forum to the root directory (be sure to backup the database and file system beforehand). To do this go to the ACP -> Server Settings -> Server Url Settings and blank the script path field before clicking Submit. Then simply move the phpBB3 files to the website root directory.
Jacob
I use the meta-way. It is so much better then the other ways mentioned here.

Jacob.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.