Reputation: 869
My zendFramework application on server shows
xyz.com/public/login
i want it like
xyz.com/login
how to achieve this ? is it possible to do with .htaccess
file?
Upvotes: 1
Views: 322
Reputation: 78971
This is my answer from another question, but seems to fit in this question too. In the case you already have a .htaccess
file inside public
, use the htaccess
solution from below.
The problem seems to be due to the root not being routed to /public
.
The proper way: You need to setup a vhost and point the root to the public
directory.
Another Way: You need to redirect every request inside public
directory. The .htaccess
for this file would be
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
Upvotes: 2
Reputation: 86346
You have to create a virtual server
Zend have a tutorial to do so.
If you are not able to create virtual server by any reason. You can put the public index.php
file outside the public folder. If you choose this method you have to add extra security methods, choosing this method lead to direct access of files.
You can prevent those direct access by creating .htaccess
in those directories with these lines-
<Files *>
Deny from all
</Files>
Upvotes: 1