3
I am having trouble creating a setup on . htaccess to hide a folder from my site.
My domain has the following structure: www.site.com.br/cake , where are the files and folders referring to the project. I want to hide the /cake directory, showing only the domain on all pages, www.site.com.br/
The current . htaccess file has the following configuration:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I’ve tried to:
RewriteCond %{HTTP_HOST} ^(www.)?site.com.br$
RewriteCond %{REQUEST_URI} !^/cake/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /
RewriteCond %{HTTP_HOST} ^(www.)?site.com.br/$
RewriteRule ^(/)?$ cake/index.php [L]
And it doesn’t work, it gives error 500. Can help me?
It is best to move the cake folder to a level above the publish folder, /home/cakephp/, that is to say without direct access, since you can move wherever you want the webroot folder, and even rename it, after that, just set the path in the define constant('ROOT', dirname(dirname(dirname(FILE)))); which is in the index.php of this public folder, pointing to /home/cakephp/
– Williams
Good evening, I wonder if the answer helped you, if not please comment on what you think is missing.
– Guilherme Nascimento