I have a site done with cakePHP and I access to the sites there like:
http://example.com/site1
Which is converted to:
http://example.com/app/webroot/site1
As I’ve searched and seen here or searching here in stack-overflow this is the normal behaviour but I’d like that the user actually doesn’t see the app/webroot bit.
Is that possible?
Here is my current .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.example.com/$1 [R=301,NE,L]
# CakePHP part
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Thank you
If you followed all the instructions to install CakePHP, the URL without
/app/webrootshould work too. If it is not working, re-download all the.htaccessfiles from the CakePHP repo. There are three files.To get rid of the
/app/webroot, i.e. never see that path on any URL, you may edit or create aVirtualHostwith aDocumentRootpointing to the absolute path of your webroot.Something like this:
This is not possible if you are on a shared server. If you are on a managed VPS or dedicated server, you need to contact your hosting. If it is unmanaged, you can do it yourself.