URL Rewrite

The generated web application requires URL Rewrite, you need to configure your web server to send HTTP requests to your PHP front-controller file, i.e. the index.php.

By default .htaccess files (for Apache) and web.config file (for IIS) will be generated for your web server. You may not need to configure manually. However, if the generated files do not work for your web server, you should check the follows.

 

Apache

Ensure that the Apache mod_rewrite module is installed and enabled. Ensure your .htaccess and index.php files are in the same directory. The .htaccess file should contain following rewrite rules:

Note There are TWO set of .htaccess files and index.php, one under the project folder, the other under the "api" subfolder.

Some Apache servers requires RewriteBase directive, you may need to add:

a. If you generate to root folder of your site,

b. If you generate to a subfolder (e.g. "demo2023") of your site,

If your server requires this setting, you can click Tools -> Advanced Settings and set RewriteBase directive, e.g. / or /demo2023/, then generate .htaccess files again.

Make sure your virtual host is configured with the AllowOverride directive so that the .htaccess rewrite rules can be used. Open your httpd.conf or apache.conf in a text editor, and locate the <Directory> section and change the AllowOverride line to ALL.

If the Apache module mod_authz_core is enabled, make sure you configure the Require directive properly, e.g. Require all granted grants access to all requests.

 

Nginx

This is an example Nginx virtual host configuration for the domain example.com. It listens for inbound HTTP connections on port 80.

Note The following assumes a PHP-FPM server is running on port 9123. You must update the server_name, error_log, access_log, and root directives with your own values. The root directive is the path to your application's public document root directory, the index.php front-controller file should be in this directory.

 

Internet Information Services (IIS)

The URL Rewrite module is not built-in, so you need to download and install the IIS URL Rewrite module from the microsoft web site. After installing, you should see URL Rewrite module in IIS Manager for your web site:

To perform the mapping, you can use the IIS Manager, but it is simpler to use web.config file directly.

Ensure the web.config and index.php files are in the same directory (the project folder). The web.config file should contain this code:

To understand more about the IIS URL Rewrite, see Using the URL Rewrite Module.

 

Also See

Web Servers
Apache Module mod_rewrite
Using the URL Rewrite Module (for IIS)

 

 ©2002-2023 e.World Technology Ltd. All rights reserved.