• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Essential code for root landing page?

sforum

Active member
#1
I have installed XenForo in a folder called xf in the root of my domain, just to maintain flexibility in case I want to use the domain for something else in the future.

At the moment, when you go to www.mydomain.com, I have the following simple index.php:

PHP:
<?php
/* Redirect browser */
header("Location: http://www.mydomain.com/xf");
/* Make sure that code below does not get executed when we redirect. */
exit;
?>
So, as you can see, when you go to www.mydomain.com you are immediately redirected to www.mydomain.com/xf and everything works just fine. :)

However, I'm guessing that this is pretty terrible from an SEO point of view; is that right? Should I have anything else in there? What about all the usual "DOCTYPE" and "meta" shenanigans that you normally see at the top of an HTML page; should I have some of that in there? If so, what?

TL;DR = Would anyone be kind enough to show a n00b like me exactly what code would be in an ideal index.php in order to redirect to the installation sub-folder, including any important "behind the scenes" gubbins?

Thanks :D
 

Brogan

XenForo moderator
Staff member
#2
I just have this in mine.

PHP:
<?php
header('Location: http://cliptheapex.com/community/pages/home', true, 301);
The 301 denotes a permanent redirect.
 

sforum

Active member
#3
I just have this in mine.

PHP:
<?php
header('Location: http://cliptheapex.com/community/pages/home', true, 301);
The 301 denotes a permanent redirect.
Ah right! In that case, perhaps I'm worrying over nothing. I thought it might mess with Google in some way if I was missing some key meta tags or something, but I've just Googled "clip the apex" and I can see that your site appears fine, all nicely defined and categorised, etc. so clearly redirects such as the one above are just fine. :)

What do the "true" and "301" variables do? I'm assuming the latter is the same as an htaccess 301 redirect (i.e. it indicates a permanent redirect), but what about "true"? Should I be adding them to my string?

Thanks. :)


Edit: Ah, you answered the 301 question as I was replying ;) Is there any benefit to having it there?