How to run concrete5 in a subdirectory? - .htaccess

I've put my concrete5 installation in the subfolder /www/concrete5. I've tried different entries in my .htaccess file but all modes seem to have some errors.
There is mainly one forum post about it
Domain root - CMS link problem
but it does not seem to work in edit mode. However, this forum post is quite old.
Is there a simple way of accessing a concrete5 installation in a subdirectory as if it were in the root?

Here is a detailed description on how to do this:
http://www.concrete5.org/documentation/how-tos/developers/hide-the-subdirectory-url/

What does your site.php file look like?
I run a lot of cms sites from subdirectories and my htaccess file is pretty standard:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I do the directory specific settings in the site.php file in the config directory.
define('BASE_URL', 'http://domain.com');
define('DIR_REL', '/dirname');

Related

.htaccess for multiple APIs addresses

I have a domain that hosts 3 different Wordpress pages and two different APIs.
It works more or less like this:
http://mywebsite.com (this one has a worpress in the root folder)
http://mywebsite.com/wordpress2 (another wordpress installed in this subfolder and having another domain redirecting to it
http://mywebsite.com/wordpress3 (same as above)
http://mywebsite.com/backend/domain1/api/v1
http://mywebsite.com/backend/domain2/api/v1
Now, I would like to have Rewrite rules for the API URLs so I can have:
http://mywebsite.com/domain1/api/v1
http://mywebsite.com/domain2/api/v1
While the URLs of the Worpress websites are left unaltered.
I have tried the below, but not working:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule domain1/api/v1(.*)$ backend/domain1/index.php?request=$1 [QSA,NC,L]
RewriteRule domain2/api/v1(.*)$ backend/domain2/index.php?request=$1 [QSA,NC,L]
</IfModule>
Can anyone shed some light? Thanks
My bad, all. It was not working because the httpd.conf file had the line "LoadModule rewrite_module modules/mod_rewrite.so" commented out.

I have a new Silex application, and only index works

This is my second Silex project, the first works fine. It is a one-page website with multi-language and twig support. Only multi-language doesn't work because nothing but the root route works. Not even $app->error().
The domain is dev.domainname.com/projectname/
The Directory Structure is:
/var/www
projectname
application
web
index.php/.htaccess, etc...
And this is my .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /projectname/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
</IfModule>
The rewrite module is loaded according to apachectl -M | grep "rewrite"
Edit I forgot to mention that the application is stored in /var/www/... but the document root for dev.domainname.com is actually in a deeper parallel folder, and there is a symbolic link to the folder. Not sure how relevant this is.

fuelphp htaccess for multiple app directory not working

I have a directory structure like below.
public_html/
/abc/
/xyz/
/pqr/
there is a index.php in each these directories, abc,xyz,pqr.
now whenever is there any request like domain.com/abc/def/ghi should be rewritten to domain.com/abc/index.php/def/ghi
domain.com/xyz/def/ghi => domain.com/xyz/index.php/def/ghi
domain.com/pqr/def/ghi => domain.com/pqr/index.php/def/ghi
What should be the .htaccess file and where it should be placed?
I have .htaccess file in each directory(abc,xyz,pqr) like below, but it is not working. it is showing 404 page not found. Please guide me to handle all these rewrite conditions.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
But this is not working... If this is right .htaccess then please tell me if there is any other server side problem. I am setting up this on CentOs server.
You will probably need a RewriteBase /abc to deal with the subfolders.
I had problem with my directory access, I was needed to update the access for content directory(domain.com) in apache config file(httpd.conf)

symfony2 on shared hosting

I've been working on this for quite a while to no avail.. I've got symfony installed on a shared web-host where I have zero access to change the DocumentRoot to the web/ folder so that is not an option to me...
I've written my htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^$ web/app.php [QSA]
RewriteRule ^(.*)$ web/app.php/$1 [QSA, L]
I have also tried this with RewriteBase web/ and RewriteBase /web/ to no avail.
With this, symfony is working.. I can login, I can do all of that... Only problem is, none of the assets are displaying... Chrome Developer Tools, is telling me it's finding a 404 which is right because it's not reading the /web/ folder as the DocumentRoot..
So, how to fix this issue without re-writing files, or anything.. There's got to be a way to do this with .htaccess only...
One way would be setting assets_base_urls in app/config.yml e.g
framework:
#..
templating:
engines: ['twig']
assets_base_urls: http://your.site.com/web/
Or, you can put a .htaccess file in your DocumentRoot folder and rewrite everything that comes in there to your /web folder accordingly:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /web/$1 [QSA,L]
</IfModule>
With that you get clean URL's (omitting "web" or "app.php") and there is no need to use the assets_base_urls stuff in your config.

Routing To A Folder In Cakephp's App/Webroot

I'm aware that there are a few questions on this subject already. I've trawled through them and can't make any of the proposed solutions work for me... maybe someone can help my specific problem?
I have a folder, parallax, in my app/webroot, containing index.html and associated files. This can be accessed just fine at /parallax/. However, if I try to access it at /parallax I get redirected to /app/webroot/parallax/, and ideally I'd like to suppress this behaviour.
Refactoring the whole thing as a CakePHP controller action isn't ideally something I want to get into (though if it might be simpler than I expect, let me know). The routes file doesn't as far as I know allow routing to a file in app/webroot.
The other port of call would seem to be the .htaccess file. I tried adding a rewrite rule:
RewritRule ^parallax$ parallax/index.html
or variations thereof, but the best I can get here is a page with broken images (whatever I'm ending up with, it doesn't seem to be able to find the images in the parallax/images subfolder any more).
Can anyone clear up my confusion and help me find the best route to /parallax giving the same result as /parallax/ does?
Please try the below .htaccess code in your root directory not in app directory.
<IfModule mod_rewrite.c>
RewriteEngine on
Rewriterule ^parallax/.*$ - [PT]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
This should help you. What ever request start with parallax will be skipped by the .htaccess rule. And rest of the things will work as it is.
.htaccess root thanks to Anh Pham for this link it works perfectly http://www.balistupa.com/blog/2010/08/how-to-redirect-appwebrootblog-into-blog-wordpress-cakephp/
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !^/foldername.*
RewriteCond %{REQUEST_URI} !-f
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/foldername.*
RewriteCond %{REQUEST_URI} !-d
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I tried to reproduce the situation but its working corretly for me. I'm using cakePhp 1.3 and both urls send me to index.html:
http://localhost:5013/parallax/
http://localhost:5013/parallax
My guess is that there's something weird on your .htaccess (the one located at /app/webroot/). Mine is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
Basically, it tells the server that if the requested url is not a file (!-f) nor a directory (!-d), it will redirect the whole url as a parameter to /webroot/index.php , so cakephp will parse the url and call the controllers and all that..
Hope this helps
You should be able to put the parallax folder with a static index.html inside the app/webroot folder and have it be accessible by default at the /parallax/ url.
If you use relative paths you can even have you img/css for that page local to the folder and skip the usual cakephp paths entirely. No htaccess needed.

Resources