Reputation: 2773
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
Upvotes: 0
Views: 1861
Reputation: 1546
If you followed all the instructions to install CakePHP, the URL without /app/webroot
should work too. If it is not working, re-download all the .htaccess
files 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 a VirtualHost
with a DocumentRoot
pointing to the absolute path of your webroot.
Something like this:
<VirtualHost 127.0.0.2:80>
DocumentRoot /absolute/path-to/app/webroot
</VirtualHost>
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.
Upvotes: 2