简体   繁体   中英

How to config htaccess for zend framework 2 use sub folder in domain

I have a sub folder domain like:

/domain.com
    L service
        L application
            L ...
        L library
        L public
            L index.php
            L .htaccess

And my .htaccess :

RewriteEngine On  
RewriteBase /service  
RewriteCond %{REQUEST_FILENAME} -s [OR]  
RewriteCond %{REQUEST_FILENAME} -l [OR]  
RewriteCond %{REQUEST_FILENAME} -d  
RewriteRule ^.*$ - [NC,L]  
RewriteRule ^.*$ index.php [NC,L]

When I run domain

http://domain.com/service ,

it auto redirect to

http://domain.com/service/public .

But I want it not use /public folder. How to fix it

public L index.php L .htaccess

Put both files outside of public folder and delete public folder. After that open index.php file and replace path

|| define('APPLICATION_PATH', realpath(dirname( FILE ) . '/../application'));

to

|| define('APPLICATION_PATH', realpath(dirname( FILE ) . '/application'));

give path of your application folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM