Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: b4pjoe - maaliskuu 01, 2009, 03:01:45 IP

Otsikko: .htaccess for subfolder
Kirjoitti: b4pjoe - maaliskuu 01, 2009, 03:01:45 IP
This seems like it should be simple and I've searched high and low and cannot for the life of me get this right. In order to preserve my sanity could someone tell me how to do this. And I do apologize if this info has already been explained before but I'm having zero luck with the search system here.

I have SMF installed in http://www.mysitesomewhere.com/forums

and I would like to access the forums using http://www.mysitesomewhere.com/

I'm pretty sure you use .htaccess but have not been able to get it right. And I also do not want to install my forums in the root folder.

I've done this with Wordpress before by using this in my root folder .htaccess file:

# BEGIN WordPress

# END WordPress


And using this as my my root folder index.php file:

<?php
/* Short and sweet */
define('WP_USE_THEMES'true);
require(
'./wordpress/wp-blog-header.php');
?>


I've tried editing the above to this for my my root folder .htaccess file:

# BEGIN SMF

# END SMF


And this as my my root folder index.php file:

<?php
/* Short and sweet */
require('./forums/index.php');
?>


I removed the line:

define('WP_USE_THEMES', true);

because it is Wordpress specific and didn't know what to change it to for SMF.

The site loads with the forum menu but the rest of it is blank except for the error that it can't load the main template.
Otsikko: Re: .htaccess for subfolder
Kirjoitti: Skhilled - maaliskuu 01, 2009, 03:11:19 IP
I don't know a lot about .htaccess but if you have cPanel you can just add a redirect to any subfolder.

You can also put this in an index.php file and it will redirect everyone to wherever you'd like:

<?php
Header
("location: http://www.mysitesomewhere.com/forums/index.php"); 
exit;
?>


Just put it in public_html.  ;D
Otsikko: Re: .htaccess for subfolder
Kirjoitti: b4pjoe - maaliskuu 01, 2009, 03:57:58 IP
Thanks for the reply. My only problem with that method is that the address still shows as http://www.mysitesomewhere.com/forums after the redirect instead of http://www.mysitesomewhere.com

But other than that it works great. Thanks.
Otsikko: Re: .htaccess for subfolder
Kirjoitti: Skhilled - maaliskuu 10, 2009, 04:28:57 IP
I'm not sure if there is a way to hide subfolders like that or not.

You're welcome. :)
Otsikko: Re: .htaccess for subfolder
Kirjoitti: JimM - maaliskuu 19, 2009, 08:05:34 IP
Here's what I get when I Googled "redirect htaccess".  You might find something there that works the way you want it. 

http://www.webweaver.nu/html-tips/web-redirection.shtml

Myself, I use the method Skhilled posted.

If this is solved, feel free to mark it as solved by clicking the Mark Topic Solved link at the bottom of the page under the linktree.