Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

I want to make my homepage /home

I have my index page as /home/index.php

How do I get the index page to automatically redirect from the top level URL without using header.

can I do something in .htaccess?

  • 2
1 Solution
Steve BinkCommented:
If you redirect, don't you HAVE to use a header?  How else would you get the redirect command to the client?  Here's two methods:

1) (in PHP) header('location:new-location.php');
2) (in JS) window.location = 'new-location.php';

you can also use this method if you would like to display something for a couple of seconds or not...  5 is the amount of time in seconds it will take before it forwards the user on...

<meta http-equiv="refresh" content="5;url=http://www.yourSite.com">

You can also do this.. as routinet mentioned...

create a function in your header like this..
function pushUser(){
     window.location.href = '/home';
Then in  your body tag call the fucntion onload like this...

<body onLoad"pushUser();">

Inside you httpd.conf or whatever file you are using for site config
within the
<virtualhost *>
Redirect /index.php htttp://www.yoursite.com/home

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now