View Full Version : Redirecting someone to the the main website
oxalic32
11-20-2004, 06:19 PM
i'm not sure how this worked but what i want to happen is this.
1) Use types my domain name into their browser, IE www.mydomain.com
2) they hit enter
3) It redirects them to www.mydomain.com/main.html
688206002
11-20-2004, 06:23 PM
Well, you can do this with javascript, meta tags, or PHP header. I recommend the last method.
You can read about PHP headers here:
http://ca.php.net/header
EDIT
Actually, why not just make index.php or index.html your main page? Much better this way...
oxalic32
11-20-2004, 07:05 PM
Originally posted by 688206002@Nov 20 2004, 07:23 PM
Well, you can do this with javascript, meta tags, or PHP header. I recommend the last method.
You can read about PHP headers here:
http://ca.php.net/header
EDIT
Actually, why not just make index.php or index.html your main page? Much better this way...
9766
How do i make it my main page?
mahangee
11-20-2004, 07:10 PM
index.php or index.htm will be the main page automatically. Just put it in your public_html folder, then when you enter your address should take you to it.
Hope that helps.
oxalic32
11-20-2004, 07:15 PM
Originally posted by mahangee@Nov 20 2004, 08:10 PM
index.php or index.htm will be the main page automatically. Just put it in your public_html folder, then when you enter your address should take you to it.
Hope that helps.
9773
where should index.php or index.htm be? I didnt change the location of anything yet...
The website files, main.html and website.swf are in the public_html
688206002
11-20-2004, 07:20 PM
By making it your main page, I meant it should be where the content for your home page is, instead of main.html; it saves a lot of unnecessary hassle this way. Everything you have should be included under the public_html directory.
oxalic32
11-20-2004, 07:27 PM
Originally posted by 688206002@Nov 20 2004, 08:20 PM
By making it your main page, I meant it should be where the content for your home page is, instead of main.html; it saves a lot of unnecessary hassle this way. Everything you have should be included under the public_html directory.
9780
What should be where the content of my page is?
oxalic32
11-20-2004, 07:49 PM
I'm using the hosting solution from here, hostmatrix.org, so i have cPanelX, does this help or make a difference? My website is
www.thissideup.hostmatrix.org/main.html , but try visiting without main.html (main.html is the file i made to be the website, when you don't add that in you go to the "index", i want it to direct you to main.html)
mahangee
11-20-2004, 07:56 PM
Great an index.php with inside it.<?php
header("Location: http://www.thissideup.hostmatrix.org/main.html");
?>
Then when you go to www.thissideup.hostmatrix.org/ it should redirect you to main.html page.
oxalic32
11-20-2004, 08:04 PM
Great, sounds like it'll work, but unfortunately i'm new to Cpanel, and im not sure where to locate index.php, i looked in the folder and file manager and couldn't find anything, could someone help me?
oxalic32
11-20-2004, 08:10 PM
Weird in Cpanel i notices it ends in /index.html
When you got to my website, it shows all the files and folders of public_html
Not sure how to edit index.php or whatever >_<
Ipsquiggle
11-20-2004, 08:23 PM
Okay; lets summarize, maybe we can get this straight.
If no file is typed into the address bar (eg. www.somedomain.com/ .. this is just the domain name, there is no file at the end.) then you will automatically be directed to the index.html in that folder, like this:
www.somedomain.com/ directs you to www.somedomain.com/index.html
www.somedomain.com/folder/somefolder/ directs you to www.somedomain.com/folder/somefolder/index.html
if index.html can't be found, other extentions are tried automatically, such as index.php, index.asp, and so on.
What they are saying is, rename your main.html to index.html. This way, when a user goes to your domain, it will automatically load up that file. Alternatively, they are saying, create a new file called index.php, and place that snippet of PHP code in it, so that when the browser automatically calls up insex.php, it will forward them to main.html.
oxalic32
11-20-2004, 09:22 PM
You can speak my langauge and now it's working, thanks everyone!
shwaza
11-23-2004, 06:49 PM
If you wanted to do it with a simple javascript code, you could just put this
[CODE]
<html>
<head>
</head>
<body onload="window.location.href='(url)'">
</body>
</html>
[CODE]
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.