Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: khoking - kesäkuu 03, 2007, 04:53:56 AP

Otsikko: Try to remove index.php from your forum and redirect index.php to /
Kirjoitti: khoking - kesäkuu 03, 2007, 04:53:56 AP
Can someone guide me on how to:

Try to remove index.php from your forum and redirect index.php to /

?

Thanks.
Otsikko: Re: Try to remove index.php from your forum and redirect index.php to /
Kirjoitti: eRott - kesäkuu 05, 2007, 12:37:10 IP
Ok, well, while i am not too sure where you want to redirect to or why or how, I will to my best to help out. Maybe if you described your situation a bit more, it would be easier.

I am assuming you do not want to use html to redirect so we will stick to PHP. There is generally one way to redirect, using the header location. Now, lets say you just simply want to redirect to lets say google. Open up index.php in your forum directory, delete all that code and replace it with:


<?php

header
("Location: http://www.google.com/"); //redirects your browser to google
exit; //this just basically ensures that no other scripts etc are running when you redirect to google

?>



Now, lets say you want your forums to still work and at the same time, redirect someone based upon some sort of information.

Lets say you want to redirect based upon if the user is for example an administrator, you would do something like:


<?php
if ($context['user']['admin'] {
header("Location: http://www.google.com/");
exit;
}
?>



I don't know, I cannot really answer your question unless you specify in greater detail, what you want to do.
Otsikko: Re: Try to remove index.php from your forum and redirect index.php to /
Kirjoitti: khoking - kesäkuu 05, 2007, 12:41:40 IP
Hi eRott,

Many thanks for replying.

Actually what I want is simple, I do not want users to see the index.php as in www.pentaxworld.com/forum/index.php, I want everything to be point to www.pentaxworld.com/forum.

Thanks.
Otsikko: Re: Try to remove index.php from your forum and redirect index.php to /
Kirjoitti: Green Beret - heinäkuu 17, 2007, 12:04:02 IP
add this
require_once("forum/index.php");
and it should only show pentaxworld.com for the url??