Redirect


#1

my main site is like http://www.domain.com/forum/forum.php

how do i make it when people come to http://www.domain.com it direct to http://www.domain.com/forum/forum.php


#2

Create an .htaccess file in the root directory of your site containing the following line:

Redirect / http://www.example.com/forum/forum.php Search the knowledge base for help with .htaccess, if you need it.


If you want useful replies, ask smart questions.


#3

i don’t get it, i create the text and put on Redirect / http://www.example.com/forum/forum.php

when it come out on the url it said
Redirect / http://www.example.com/forum/forum.phpRedirect / http://www.example.com/forum/forum.phpRedirect / http://www.example.com/forum/forum.phpRedirect / http://www.example.com/forum/forum.phpRedirect / http://www.example.com/forum/forum.phpRedirect / http://www.example.com/forum/forum.phpRedirect / http://www.example.com/forum/forum.php linking together


#4

Please give us a more detailed description of what you did and what’s happening now. How did you create/upload the .htaccess file? Is there anything else in the file? Do you have an index page at the root of your site? Is there anything else we should know? What’s the actual URL so we can see the problem ourselves?


If you want useful replies, ask smart questions.


#5

i don’t have the index page at my root, i upload it in binary and chmod it to 644,

i create a .htaccess text with no word wrap
in there i put

Redirect / http://www.example.com/forum/forum.php

then upload it as ASCII mode

and it not work


#6

An easy way to do this without .htaccess is to place an index.php file with only the following line (no blank lines) in the root directory at domain.com:

<?php header('Location: http://www.domain.com/forum/forum.php'); ?>-----------------
MacManX.com
I don’t work here. I’m just your typical support forum volunteer.


#7

If I am not mistaken, it’s proper to also add a relevant HTTP status code:

<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.domain.com/forum/forum.php"); header("Connection: close"); ?>

#8

That’s not necessary, especially considering that PHP header calls don’t function properly under PHP as CGI.


MacManX.com
I don’t work here. I’m just your typical support forum volunteer.


#9

in htaccess:

Redirect /forum/forum.php http://www.domain.com

should work

oops, no that wont work -that would do the opposite of what you want.

This should: make a blank index.html page, put it in the root.

in htaccess:

Redirect index.html http://www.domain.com/forum/forum.php

(with domain.com replaced by your actual domain).


#10

I don’t know if the above will work if somebody just types in the domain as a URL; it seems like it would only redirect it if they actually typed “index.html” in the URL, which they usually won’t.

– Dan


#11

No, it will work but with one minor change:

Redirect /index.html http://www.domain.com/forum/forum.php

(needs the slash before index.html)

Works like a charm. Hope OP can get this to work.


#12

yeah it work thank friend