[SOLVED] make sub folder cmsms site appear as root site

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

[SOLVED] make sub folder cmsms site appear as root site

Post by blackhawk »

Within my live web host environment, if I install my cmsms directory in a sub folder like,

Code: Select all

www.site.com/cmsms2015/
...are there are configuration tactics within cmsms to reveal this site as...

Code: Select all

www.site.com/
for all links and and pages within this sub directory?

Thanks for any tips
Last edited by blackhawk on Tue Dec 02, 2014 3:03 am, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: How to make sub folder cmsms site appear as root site

Post by Rolf »

I have main website in a subfolder named www
.htaccess in the root of the server

Code: Select all

#
RewriteEngine On
RewriteBase /www

# redirect to www-directory and hide the /www in the URL
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule !^www(/?|/.+)$ /www%{REQUEST_URI} [L]
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: How to make sub folder cmsms site appear as root site

Post by blackhawk »

Thank you Rolf,
appreciate your help always!

Let me go ahead and try this step...
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: How to make sub folder cmsms site appear as root site

Post by JohnnyB »

Maybe rewrite the url without that sub directory.

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !(.*)cmsms2015
RewriteRule ^(.*)$ cmsms2015/$1 [QSA]
The above might work. But, if you are using SEO mod rewrite style URLS, then it might get a bit tricky.... I didn't test this so, you'll need to experiment.

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.*)cmsms2015
RewriteRule ^(.*)$ cmsms2015/index.php?page=$1 [QSA,L]
And, what if the admin directory is inside of that cmsms2015/ directory? We probably shouldn't remove it from the URL then....

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.*)cmsms2015
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^(.*)$ cmsms2015/index.php?page=$1 [QSA,L]
if the line
RewriteCond %{REQUEST_URI} !(.*)cmsms2015
doesn't seem to help, you can try
RewriteCond %{REQUEST_URI} !^/cmsms2015

If you do any 'www' redirects to add or remove the www prefix from the domain, you'll need to put that first, above all the other stuff above.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: How to make sub folder cmsms site appear as root site

Post by Jeff »

The proper way (if your host allows it) is it update the site profile/definition to the new root directory.


Jeff
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: How to make sub folder cmsms site appear as root site

Post by psy »

right or wrong, this is how i do it.

1. .htaccess in root directory where my sub dir is 'cms', eg:

Code: Select all

RewriteEngine On
# force www IN URL
RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
# END force www IN URL 

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule !^cms(/?|/.+)$ /cms%{REQUEST_URI} [L]
2. .htaccess in my 'cms' dir is the default supplied by CMSMS.

3. I add the following to my config.php file:

Code: Select all

$config['root_url'] = 'http://www.mysite.com';
$config['root_path'] = '/home/mysite/public_html/cms';
HTH
psy
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: How to make sub folder cmsms site appear as root site

Post by blackhawk »

Thank you team,
I will play with the following solutions today and see if I can make something work on my end...

Thank you for the rich feedback!

O0
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: How to make sub folder cmsms site appear as root site

Post by Dr.CSS »

Why wouldn't you just move it to the root of the site instead of having in a sufolder..?
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: How to make sub folder cmsms site appear as root site

Post by psy »

Root folders can get very messy. This keeps it tidy.

I use it most often when rebuilding a site for a client. Live site can continue until the new site is ready to launch. Then, forget all the hassle of exporting/importing databases, files, etc - just a minor change to the config.php file and update the htaccess files to point to the new site subfolder as the TLD and it's job done.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: How to make sub folder cmsms site appear as root site

Post by paulbaker »

psy wrote:Then, forget all the hassle of exporting/importing databases
You wouldn't need to do anything to the database if you are just moving the website up one directory level. Personally I move the files, doesn't take long and when I look at the site months/years later (when I have forgotten all about it) it's obvious what is going on without having to dig in to htaccess files etc.

But I guess much of this thread simply boils down to personal preference....as long as it works, who cares about the technicalities? :D
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

[SOLVED] How to make sub folder cmsms site appear as root si

Post by blackhawk »

I like the archiving approach for sub folders, this way I can go back and see what I did on older sites. I solved my problem by un-assigning my add-on domain name, and then re-assigning it again to the newer sub folder, all through my cPanel. I can now do this every single time there is a major web site upgrade, which may also represent a newer cmsms environment too.

Thanks!
Locked

Return to “The Lounge”