Site opens in the webroot folder

-2

The site I'm putting online is displaying http://mysite.com/app/webroot/ whenever you put www.mysite.com in the path to access it. However I wanted it to just go to http://mysite.com/ , where the Home.ctp view is.

I'm using Cake version 2.4.4.

htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>
    
asked by anonymous 07.04.2014 / 17:04

1 answer

1

There are two ways to resolve this:

1) Cpanel / Plesk

Create a redirect of every request with http://www to http://push... .

For example .. on BlueHost you do this on this page (it's pretty much the same operation on all Cpanels).

What you must select in this case is your domain, and do not leave selected All Domains, otherwise all requests on this server will be redirected to the URL which you reported below.

Otherwise, below there are some radio buttons, which you select if you want to redirect only when the URL has www , in both cases or not redirect www.

2) .htaccess

In your% of root% (the first), do the following:

<IfModule mod_rewrite.c> 
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
   RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

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

Choose one of the above ways and test.

Any questions, leave a comment below.

    
09.04.2014 / 16:28