Zend Framework application without virtual hosts

Is it possible to configure a web server in Windows (Apache or IIS) without setting up virtual hosts that could be accessed by a Zend Framework application with a link, for example http://example.com/myapp , and not http: // example. com / myapp / public ?

+4
source share
4 answers

use this .htaccess

RewriteEngine On RewriteRule ^(.*)$ public/$1?%{QUERY_STRING} [QSA,L] 

and put this in application.ini

 resources.frontController.baseUrl = "/myapp/" 
+12
source

Insert the .htaccess file with the following contents into the myapp :

 RewriteEngine on RewriteRule (.*) public/$1 
+1
source

Create a .htaccess file and place it in the root directory with the following content

 RewriteEngine on RewriteRule (.*) public/$1 

And add the line below to the file application / configs / applicaton.ini

 resources.frontController.baseUrl = "/myapp/" 

There will be no errors, I will work fine.

0
source

As shown in the zend documentation here https://framework.zend.com/manual/2.4/en/user-guide/skeleton-application.html#using-the-built-in-php-cli-server , you can use embedded CLI server with command

 php -S 0.0.0.0:8080 -t public/ public/index.php 

to start it just open the command prompt and type the command above, for example

 php -S 0.0.0.0:8080 -t {path_of_project's_public_folder} {path_of_project's_public_folder_upto_idex.php_file} 

then press enter, and now you can open your project as follows http: // localhost: 8080 / . Your application runs on port 8080, you can change it to something else, for example, 8000 or 5050.

I hope this helps someone.

0
source

Source: https://habr.com/ru/post/1339640/


All Articles