How to remove “public” from url using routeing in zend framework

前端 未结 3 635
我在风中等你
我在风中等你 2021-01-07 09:19

An one issue in my zend, i write rule in .htaccess to remove \"public\" from url as following,

--------------------------------------------------------------         


        
3条回答
  •  我在风中等你
    2021-01-07 09:40

    zf2 and zf3 remove Public from URL

    create index.php and .htaccess add file in root of project

    add the line in index.php include_once("public/index.php");

    and in .htaccess file

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] 
    

    after that go to following path

    Module->application(module name)->view->layout->layout.phtml change css and js path add public in path

    before

    ->prependStylesheet($this->basePath('css/bootstrap.min.css'))

    ->prependFile($this->basePath('js/bootstrap.min.js'))

    after

    ->prependStylesheet($this->basePath('public/css/bootstrap.min.css'))

    ->prependFile($this->basePath('public/js/bootstrap.min.js'))

    also in image path

提交回复
热议问题