Page 1 of 1

How to redirect index page?

Posted: Wed Dec 07, 2005 11:29 am
by ljCharlie
Here's what I'm trying to do. When people type in http://www.mysite.com/enewsletter/ in the URL, the browser will load the index.php page by default. But what I wanted to do is when people type this, http://www.mysite.com/enewsletter/, in the URL I want the browser to load http://www.mysite.com/enewsletter/enews.php?id=1. Can this be done? If yes, mind showing me the steps?

Thanks!

Posted: Wed Dec 07, 2005 11:32 am
by Burrito
mean you want the browser to redirect do you? Or simply load the page as if that were in the URL you want?

Posted: Wed Dec 07, 2005 11:32 am
by John Cartwright
search these forums for mod_rewrite

Posted: Wed Dec 07, 2005 11:36 am
by ljCharlie
Yes, that is what I want. I want the browser simply load the page as if that were in the URL. Can this be done?

And yes, I will search for mod_rewrite. I hope it's not too difficult.

Posted: Wed Dec 07, 2005 11:42 am
by John Cartwright
Are you using Apache?

Posted: Wed Dec 07, 2005 12:25 pm
by ljCharlie
Many thanks for your help. Yes, I think I'm using an Apache but I'm not the web server administrator. Any I found that this:

Code: Select all

if (!isset($_GET['id'])) {
header ("Location: index.php?id=1");
}


works on my case.