Redirect

Started by newtoallthis, February 16, 2011, 06:11:17 PM

Previous topic - Next topic

newtoallthis

Sorry if this is the wrong place to post this, but I can't find a better one!

I have SMF 2 hosted at GC Solutions and am reserving the root directory for something at a future date. I have a subdirectory in the root named 'forum'. What can I do meanwhile to automatically redirect people from root to 'forum'

SMF 2.0.11
Simple Portal 2.3.3
Aeva Media 1.4c
MediaWiki 1.24.0

larryhyman

In your root index.html

you can do this in the header section (but it's not really search engine friendly)

<meta http-equiv="refresh" content="0;url=forum/" />

or you can use google to find a javascript redirect for your <body> tag
In god we trust, all others pay cash !

http://hyman.sytes.net

MrPhil

#2
For Apache servers, add this to .htaccess
RewriteEngine On
RewriteRule ^$  /forum

or something close to that. The intent is if just the root directory is given, they will be sent to /forum. This assumes that your forum is set up with the full proper directory structure (/forum) already, and only needs to give visitors to the site root a little push into the forum. Anything other than the bare domain (root) presumably already has the correct path in it.

Once you have some sort of landing page in the root, with a link to the /forum, remove the URL rewrite.

ACAMS

Save this code as index.php and put it in the root.



<?
header( 'Location: http://YOURSITE.WHATEV/forum (assuming this is really where your forum is)/index.php' ) ;
?>



So, I would guess it would look like this


<?
header( 'Location: http://gcsolutions.com/forum/index.php' ) ;
?>

newtoallthis

As I say, I'm new to all this.

It happens that my host uses cPanel on his server and this has a redirect function. Choose the target and source of the redirect and it's done.

Thanks so much for your replies. Hopefully, they will assist others who may have to do a similar thing manually.
SMF 2.0.11
Simple Portal 2.3.3
Aeva Media 1.4c
MediaWiki 1.24.0

Advertisement: