Redirects

carlbme

[H]ard|Gawd
Joined
Aug 17, 2001
Messages
1,258
I need some info on making redirects work.
I've tried the .htaccess and the meta tag versions and can't seem to get either one to work on my webserver. I either get some sort of loop that causes it to try to redirect several times over which causes an invalid url or just a blank white page.

I'm just trying to try to redirect from my main folder (public_html) to a subfolder (/forum/portal.php) due to the fact that I messed up and loaded the portal under the wrong directory. I'm really not wanting to take and redo it to make sure it goes to the actual root directory.
 
pr0pensity said:
DirectoryIndex /forum/portal.php

.htaccess ??

EDIT: Yup, .htaccess.....although doesn't quite work.

Better than most of the others I've tried, but I guess I have to tweak the HTML/PHP/Java of the site itself it get this to work, lol
 
(assuming apache) server side you can use the redirect command in your .conf
http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect
ex Redirect permanent / http://jomomma.com/subdir/

and I know you already tried it, but here's an example of the meta-refresh. It should live in the <head> section of your page. Also keep in mind that the browser has to allow the redirect.
<meta http-equiv="refresh" content="2;url=http://jomomma.com/subdir/">

Either of those should work. Cant guess from what you've given as to why it would cause a loop though. :confused:
 
carlbme said:
.htaccess ??

EDIT: Yup, .htaccess.....although doesn't quite work.

Better than most of the others I've tried, but I guess I have to tweak the HTML/PHP/Java of the site itself it get this to work, lol
What doesn't work?

-nevermind. Remove the leading slash and try it.
 
Frobozz said:
Cant guess from what you've given as to why it would cause a loop though. :confused:

I'm lost on that one too.. here is the code

code.JPG


Then here is the error...

error.JPG



pr0pensity said:
What doesn't work?

-nevermind. Remove the leading slash and try it.

Well....it works....sort of

redirect2.JPG
 
change it to
DirectoryIndex index.php

in the index.php file:

<?
header("location: http://www.domain.com/forum/portal.php");
?>
 
pr0pensity said:
change it to
DirectoryIndex index.php

in the index.php file:

<?
header("location: http://www.domain.com/forum/portal.php");
?>


SWEET!!!

Thanks, it works now. I tried the php code in the normal index.htm file (with no .htaccess) with no success. Now that you point that out I feel a bit like a moron for missing it, but definatly happy it's working...Thanks
 
Back
Top