.htaccess does not allow entering folders

Asked

Viewed 243 times

1

I have a website in Cakephp and its due htaccess correctly. The problem is because I created an additional domain in the hosting and as usual, it creates a folder in the public_html to put the files of this new domain getting for example public_html/dominio2. I played all the files there, from the other site, only because of htaccess, when I enter www.dominio2.com.br it returns me erro 500. If I rename the .htaccess from the root of Cake, so he goes into dominio2.com.br just that the cake files get all messed up. The htaccess I have today

htaccess

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

What I can put there in case the request is for a folder, then it enters the folder and does not perform the passage to webroot ?

  • your cake is at the root of public_html?

  • Yes, it’s in public_html

  • Put it in another folder and point your domain to that folder.

  • It’s the only way out ?

  • This is the easiest, but you can put a condition so he doesn’t read the rules for a specific domain, but will have to keep adding new domains.

  • Try entering your domain configuration and make it point directly to your public_html folder

Show 1 more comment

1 answer

0

You need to add a condition to . htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^dominio1.com.br$ [NC]
    RewriteRule    ^$ app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

That way, when you enter the domain 2.com.br, it will not read the Rewriterule of . htaccess’s domain 1.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.