Didn't install in root, but would like URL to display as root

Permalink 1 user found helpful
Installed C5 in /test. Now, it's ready to go live, but I don't want to copy everything to the root and risk breaking everything and complicating my life. Is it easy to remove /test from the URL somehow with site.php or something?

In other words, change:

mydomainname.com/test/index.php

to

mydomainname.com/index.php

 
codingpenguins replied on at Permalink Reply
Not 100% sure what you want, because if you want the site to be actual at mydomainname.com/index.php this is not possible (that I know about at all, wanna say 100% but c5 might have some crazy function but it does not logically make since to me) and not because of concrete5, but just because of file logic on the server. You could always do a redirect (but not the same thing because 'test' will still be there). Technically just move everything from mydomainname.com/test/ to mydomainname.com/ and if anything goes wrong refer to mydomainname.com (you can have both on and have two concrete5 sites at the same time!) So you do not have to worry about crazy stuff happening. --- Just make sure - for some reason crazy reason have a test folder in test ie mydomainname.com/test/test/. Follow the directions fromhttp://www.concrete5.org/documentation/installation/moving_a_site/... and you should be fine!
MrNiceGaius replied on at Permalink Best Answer Reply
MrNiceGaius
Just thought I'd share a way to install c5 into a subdirectory without the /subdirectory/ showing up in the URL.

Requires Apache .htaccess files: 1 in root directory & 1 in c5 sub-directory.

#root level htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?your-domain-name\.com$
RewriteCond %{REQUEST_URI} !^/c5-subdirectory/
RewriteRule ^(.*)$ c5-subdirectory/$1 [L]
<IfModule mod_rewrite.c>



and in your c5 subdirectory this .htaccess (notice no subdirectory in the value for 'RewriteBase')
#subdir level 2
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
# -- concrete5 urls end --


I'm actually using this method for a modx installation and it works perfectly... in theory it should work just fine with c5.

The above code does not take into account different domain names assigned to different sub-directories but by changing the RewriteCond %{HTTP_HOST} ^(www\.)?your-domain-name\.com$ and applying a new RewriteRule to a different subdirectory should do it.

Let me know how it works for you.
zoinks replied on at Permalink Reply
Thanks. I'm working with a guy in California (who's C5 forum handle I have forgotten since I talk to him through email only for the past couple months) and he offered this advice:

"As far as removing /test I think there's two steps you need to make..change your host docroot to be public_html/test for the leadership domain. Then remove the DIR_REL config file option.

Once that's done you should be good as long as no one hard-coded /test/ into URLs..."

So, it's good to have another technique to fall back on in case one doesn't work. Thanks, MrNiceGaius!

(edit: it may be the same advice in different words; I'm not sure. I know nothing about docroot and server rewriting as I am not a server guy)
MrNiceGaius replied on at Permalink Reply
MrNiceGaius
Interesting, indeed that will most likely accomplish what you're looking for...

although, you won't be able to install multiple sites ( as with the above htaccess rewrite method ) ... but in your case that's most likely irrelevant. ( update, actually thinking about it now you're right, these two methods are essentially the same thing ) I believe with the method I posted it requires the DIR_REL value to be empty as well. )

Thanks for sharing, good tip.
zoinks replied on at Permalink Reply
I'm happy to see your tip and to know that this possibility exists! I would love to start setting up multiple clients on one server if they feel like being cheap.
MrNiceGaius replied on at Permalink Reply
MrNiceGaius
I'm not sure how I would use the method for multiple clients, mainly because it's still under one account.

The method works well for setting up multiple sites for one client though.