Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

.htaccess for subfolder

Aloittaja b4pjoe, maaliskuu 01, 2009, 03:01:45 IP

« edellinen - seuraava »

b4pjoe

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.

Skhilled

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

b4pjoe

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.

Skhilled

I'm not sure if there is a way to hide subfolders like that or not.

You're welcome. :)

JimM

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.
Jim "JimM" Moore
Former Support Specialist

Advertisement: