Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: peps1 on January 28, 2015, 02:08:01 PM

Title: how to redirect a page?
Post by: peps1 on January 28, 2015, 02:08:01 PM
I recently had to move my form for my root into a folder on the root (due to file permissions, windows hoasting, godaddy bla bla bal)

So right now I just have a index page on the root with a hyper-link to the forum.

Is there a way to just set up a auto redirect, so anyone going to mydomain/index.html automatically get sent to mydomain/forum/index.php 
Title: Re: how to redirect a page?
Post by: Kindred on January 28, 2015, 02:09:46 PM
Are you actually running SMF 2.1 beta1?

Your posts in the other boards suggest not....

there is a way... but it differs between windows and linux hosting...  so, which one are you actually running?
Title: Re: how to redirect a page?
Post by: peps1 on January 28, 2015, 02:23:06 PM
sorry, yes I posted in totally the wrong place........its been a long day!

I'm on 2.0.9

I currently have a index.php with the following code, but not sure if this method has downsides as there seems to be 101 ways to do it, all with pros and cons, mainly SEO.

<?php
 header
('Location: http://mydomain/forum/', true, 301);
 exit();
?>
Title: Re: how to redirect a page?
Post by: austin.bollinger on January 28, 2015, 02:29:23 PM
Quote from: peps1 on January 28, 2015, 02:23:06 PM
sorry, yes I posted in totally the wrong place........its been a long day!

I'm on 2.0.9

I currently have a index.php with the following code, but not sure if this method has downsides as there seems to be 101 ways to do it, all with pros and cons, mainly SEO.

<?php
 header
('Location: http://mydomain/forum/', true, 301);
 exit();
?>


Permanent redirect PHP, that is as good as it gets my friend. If it is working, all is well. You could also use .htaccess --- I'm a bit tipsy though. Just look up ".htaccess redirect"........ http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/
Title: Re: how to redirect a page?
Post by: Kindred on January 28, 2015, 02:48:41 PM
except htaccess mostly only works well on linnux and not well on windows... which is, again, why I asked....
Title: Re: how to redirect a page?
Post by: peps1 on January 28, 2015, 02:52:57 PM
Quote from: Kindred on January 28, 2015, 02:48:41 PM
which is, again, why I asked....

I'm on Windows hosting.
Title: Re: how to redirect a page?
Post by: Kindred on January 28, 2015, 03:03:22 PM
in that case, your php redirect using the header is probably your best option...
Title: Re: how to redirect a page?
Post by: Arantor on January 29, 2015, 08:46:38 AM
Eh?

.htaccess works fine on any Apache server, regardless of operating system. But Windows hosting doesn't always use Apache... hard to know what's actually in use here. If it's Apache, .htaccess will work fine. If it's IIS, you will need to do it in PHP.
Title: Re: how to redirect a page?
Post by: Kindred on January 29, 2015, 10:25:24 AM
Ah. Thanks for that clarification, Arantor...   you are indeed correct -- and I was assuming that windows server == IIS... which is potentially incorrect.
Title: Re: how to redirect a page?
Post by: austin.bollinger on January 29, 2015, 06:10:14 PM
This is also somewhat relevant: http://stackoverflow.com/questions/257936/htaccess-or-htpasswd-equivalent-on-iis

In case someone is running an IIS server and wants an .htaccess equivalent rewrite.