htaccess and subfolder

Permalink
I am deploying a new Concrete5 website in a sub-folder of public_html (let's call it newsite) and I need to change the htaccess file to point from the old site (in the root) to the new site (in newsite)

I don't want to conflict with the .htaccess file in the newsite folder.

The instructions from the web host tell me to add this to the htaccess file

# Turn on rewrites.
RewriteEngine on
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/folder/
# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ /folder/$1
# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ folder/index.php [L]


Can I use this code directly, or do need to modify it in some way to accommodate Concrete (such as not use index.php in the root folder redirect rewrite rule?

pthalacker

 
jjdb210 replied on at Permalink Reply
jjdb210
I would strongly recommend moving concrete to the root, and not doing it this way... Especially if your using canonical urls.

It should be able to be made to work if you have to do it this way, but you may need to update some settings in your config.php file once you launch it... (which you would have to do if you moved folders as well)

Something is telling me though that I tried to do what your suggesting a few months ago and ran into occasional trouble (mainly with the admin, which doesn't use canonical urls)

Also, I'm not sure about that last rewritecond. I'm not sure why your checking for HTML in the HTTP_HOST value... but maybe i'm missing something :-)
pthalacker replied on at Permalink Reply
We aren't using any canonical urls, but we are using pretty urls. That is the main reason I posted. It looks to me that Concrete uses the .htaccess file to facilitate pretty urls and I wanted to make sure that the entries in the root .htaccess folder don't interfere with the one in the sub-folder.

I have no sense of how Apache processes these things. I can guess from the RewriteRule, but I am not sure. It appears that I might be able to remove the .htaccess file from the sub-folder if I had the correct rules in the root .htaccess file, but again I have no experience.