Again... use a subdomain folder and make it appear root

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Again... use a subdomain folder and make it appear root

Post by jack4ya »

I've googled, I've searched the fora... I just do not get it... and I run into this problem every single time... and every single time,after hours of messing, I end up restoring the user backups, clean install again, download and upload all modules and copy paste all (!!!!) templates. This can't be right: it must be easier then this.

I have:
subdomain.domain.com
which is essentially:
"http://www.domain.com/subdomain"

Now leaving the cms in 'folder' (for testing, developing, etc) when done, I do NOT want to move the system, but I want to rewrite request so everything (including pretty urls) looks like
"http://www.domain.com"

So when "http://www.domain.com" is entered it should silently get everything from "http://www.domain.com/subdomain" but the urls should look and act like an root install

I've tried but prerhaps in the wrong folders?
http://forum.cmsmadesimple.org/viewtopi ... 48#p317148
and
http://forum.cmsmadesimple.org/viewtopi ... 61#p317161
and
http://forum.cmsmadesimple.org/viewtopi ... 11#p318511

But all I get is a white "http://www.domain.com"
Last edited by jack4ya on Fri Jan 16, 2015 9:00 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Again... use a subdomain folder and make it appear root

Post by calguy1000 »

Again, this is not really a CMSMS issue (other than maybe having to adjust a few config entries).

The web server dictates what directory certain URL's are available from what directories. Their software, and their configuration levels dictate what you can change, and where it has to be changed.

Some web control panels will allow you to specify that domain.com is to be served from /home/myusername/public_html/foo. Some may require you to fudge with .htaccess, and others will not allow that at all.

Your best bet is to:
a: contact your host for instructions
b: test everything with a couple of static HTML pages. and get it working
c: Then modify the appropriate CMS config entries and get it working.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: Again... use a subdomain folder and make it appear root

Post by psy »

A white page sometimes indicates a problem with Apache PHP handlers. Check your htaccess file is using the correct handler for your version of PHP.
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Again... use a subdomain folder and make it appear root

Post by jack4ya »

BTW the white page was something else indeed, but I still can't get it to work.

So I am talking about the config file and the lines...

My actual path is
/domains/domainname.com/public_html/
or when in subdomain
/domains/domainname.com/public_html/subdomain

And unfortunately I am the reseller(hoster) of the domains and have access to some settings in DirectAdmin... so I would be contacting myself here. ;)

I can't really test more on my latest project... I just copied the whole damn thing again, same database and ran the upgrade.

But I still would like to know for future reference.

I feel, using only default setup (for server and cms both) now, I should be able to do this by the config en htaccess files... but how??
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Again... use a subdomain folder and make it appear root

Post by Rolf »

jack4ya wrote:...have access to some settings in DirectAdmin...
I used my method - described in the other thread - when I had a website at a host with <blergh>DirectAdmin</blergh>
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: Again... use a subdomain folder and make it appear root

Post by paulbaker »

jack4ya wrote:But I still would like to know for future reference.
This is my general work flow. Works great for me. Might work for you?

New client. Set up latest CMSMS on mytestdomain.co.uk/clientname

Period of testing, working on this "hidden" area that client knows about and can access.

Stylesheets reference images like this:
background-image: url(/clientname/uploads/images/SiteStructure/image.png);

When it comes to making site live:

Site-down message: "Test site is now offline" (so client doesn't get confused over which site to look at now).

Back up MySQL CMSMS database.

Zip up all site files. (Cpanel hosting or similar is well worth having, makes tasks like this easy).

On live domain hosting:

Create new MySQL database, import data from backup you made.

Upload and unzip all site files in to root.

Modify connection details in config.php.

In stylesheets, bulk-remove text "/clientname" (takes seconds in a good text editor).

Remove site-down message.

We're live.

Set up pretty URLs.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Again... use a subdomain folder and make it appear root

Post by velden »

Stylesheets reference images like this:
background-image: url(/clientname/uploads/images/SiteStructure/image.png);
What about:

Code: Select all

background-image: url([[uploads_url]]/images/SiteStructure/image.png);
Best method IMO as it will work always. Also when using a subfolder etc. And you can skip a step.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: Again... use a subdomain folder and make it appear root

Post by paulbaker »

Thanks, yes you're right that would make it even easier. Although you do end up with the full domain name in the stylesheet for each image you call, making the stylesheet longer than it needs to be:

Code: Select all

background-image: url(http://www.example.com/uploads/images/SiteStructure/image.png);
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Again... use a subdomain folder and make it appear root

Post by jack4ya »

paulbaker wrote:
jack4ya wrote:But I still would like to know for future reference.
This is my general work flow. Works great for me. Might work for you?

New client. Set up latest CMSMS on mytestdomain.co.uk/clientname

Period of testing, working on this "hidden" area that client knows about and can access.

Stylesheets reference images like this:
background-image: url(/clientname/uploads/images/SiteStructure/image.png);

When it comes to making site live:

Site-down message: "Test site is now offline" (so client doesn't get confused over which site to look at now).

Back up MySQL CMSMS database.

Zip up all site files. (Cpanel hosting or similar is well worth having, makes tasks like this easy).

On live domain hosting:

Create new MySQL database, import data from backup you made.

Upload and unzip all site files in to root.

Modify connection details in config.php.

In stylesheets, bulk-remove text "/clientname" (takes seconds in a good text editor).

Remove site-down message.

We're live.

Set up pretty URLs.
Right...
That is what I do now... as a work around.
Just thought there should be a better way.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Again... use a subdomain folder and make it appear root

Post by calguy1000 »

Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Again... use a subdomain folder and make it appear root

Post by jack4ya »

Now, I *could* be offended, but I'm not. ;)

Being an autodidact, means the sometimes I'm really flawed at the proper names for things.


The moments someone says: "Have you tried to do Name A?"
- "What is name A?"
"It's when you do these things and/or these things that look like that."
- "Ah! It has a name? And that's the name for that thing!"
(And already probably been using it for yeeeaaarrrsss... ;D )
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Again... use a subdomain folder and make it appear root

Post by jack4ya »

For others (and a reminder to me)

put the default .htaccess (from the doc folder) in the 'subfolder'.
put the 'custom' .htaccess (below) in the 'maindomain' folder:

Code: Select all

# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.

# Do not change this line.
RewriteEngine on

# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/

# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1

# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ subfolder/index.php [L] 

Locked

Return to “The Lounge”