Go Back   vb.org Archive > Community Discussions > Forum and Server Management
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2017, 03:09 AM
Zachariah's Avatar
Zachariah Zachariah is offline
 
Join Date: Feb 2002
Location: Canoga Park, CA
Posts: 2,125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [fixed] htaccess and 2 plus domains

I wanted to run some ideas by the community and seek some advice on setup and settings. On a shared host plan there are 2 domains on the same package (max 10). I was thinking of changing the file layout to redirect requests to subfolders. It seems less messy on the FTP side as the account approaches 10 domains with their own file structure and content.

Current Cpanel layout:
  • Doamin1.com is the main domain.
  • Domain2.com is a add-on domain (max 10)

Current file locations were setup:
  • domain1.com => /public_html
  • domain2.com => /public_html/site2

Desired layout of file structure:
  • .htaccess => /public_html
  • domain1.com => /public_html/site1
  • domain2.com => /public_html/site2

Future as domains are added:
  • domain3.com => /public_html/site3
  • domain4.com => /public_html/site4
  • domain5.com => /public_html/site5
  • domain6.com => /public_html/site6
  • domain7.com => /public_html/site7
  • domain8.com => /public_html/site8


Are there any htaccess configurations that come to mind that could make this workout ?

Thank You.

--------------- Added [DATE]1488317132[/DATE] at [TIME]1488317132[/TIME] ---------------

It was quite easy once you think about it.

Point all domains to the web accounts single public web folder via CPanel domain tools.
  • site1.com => /public_html
  • site2.com => /public_html


Create a .htaccess file in /public_html that will push requests to the correct subfolders where each website is contained.

EX:
  • site1.com => /public_html/site1
  • site2.com => /public_html/site2


Code:
Options +FollowSymLinks

RewriteEngine on
#=================================================================================
# FIRST Handle the http requests first before removing the additional url junk
#=================================================================================

#rule for site1.com to link to site1folder directory
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteCond %{REQUEST_URI} !^/public_html/site1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site1/$1

#rule for site2.com to link to site2folder directory. Its the same as above just with site2 URL and sub-folder
RewriteCond %{HTTP_HOST} ^(www.)?site2.com$
RewriteCond %{REQUEST_URI} !^/public_html/site2/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site2/$1

#==========================================================
# SECOND Remove the additional url junk once the new url is loaded
#==========================================================

#rule for site1 url rewrite to remove /site1folder/index.php from the URL
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteRule ^(/)?$ site1/index.php

#rule for site2 url rewrite to remove /site2folder/index.php from the URL. Again its the same as above just with the site2 URL and sub folder info.
RewriteCond %{HTTP_HOST} ^(www.)?site2.com$
RewriteRule ^(/)?$ site2/index.php
This can be done repetitively to add more domains to the server.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:22 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06220 seconds
  • Memory Usage 2,167KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete