Set up zend project in live server [closed]

2019-09-22 08:49发布

Actually, I have created account in 000webhost.com free hosting, I uploaded system successfully. But I am able to run it only through this link aubergeikaze.netne.net/public/. The server is based on Apache:

//////////////////////.htaccess file \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Do not remove this line, otherwise mod_rewrite rules will stop working

RewriteBase /
/////////////////////////////////////////////////////////////////////

How can I configure http://aubergeikaze.netne.net/public/ to http://aubergeikaze.netne.net/ server in Apache. Thanks

1条回答
Explosion°爆炸
2楼-- · 2019-09-22 09:08

One solution is documented in Zend Framework on a shared host

Essentially, you need an index.php and a .htaccess file in the root folder as that's where Apache is serving from.

index.php:

<?php 
define('RUNNING_FROM_ROOT', true);
include 'public/index.php';

.htaccess:

SetEnv APPLICATION_ENV production

RewriteEngine On
RewriteRule .* index.php

You'll also need to sort out the paths to static assets like CSS and JS files. You can either change the paths to include public/ or write a plugin to to it for you.

Another option as noted in the comments to this answer (formatted here for readability):

Create an .htaccess file into root folder with this content:

RewriteEngine On 
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 
查看更多
登录 后发表回答