Skip to content
やかみそら edited this page Aug 9, 2017 · 17 revisions

URL

Server Configuration

Apache:

<VirtualHost *:80>
# Host that will serve this project.
    ServerName example.com
 
# The location of our projects public directory.
    DocumentRoot /path/to/your/kotori.php/public

# Rewrites for pretty URLs, better not to rely on .htaccess.
    <Directory /path/to/your/kotori.php/public/>
        <IfModule mod_rewrite.c>
            RewriteEngine on
			RewriteCond %{REQUEST_FILENAME} !-d
			RewriteCond %{REQUEST_FILENAME} !-f
			RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
        </IfModule>
    </Directory>
</VirtualHost>

Nginx:

server {
listen 80;
listen 443 ssl http2;
server_name example.com;
access_log off;
index index.html index.htm index.php;
root /path/to/your/kotori.php/public;


location / {
    try_files $uri @kotori;
    }

location @kotori {
        set $static 0;
        if  ($uri ~ \.(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css\.map|min\.map)$) {
            set $static 1;
        }
        if ($static = 0) {
            rewrite ^/(.*)$ /index.php?_i=$1;
        }
    }

}

URL format

The entry file is the single entry for the application. All requests for the application are directed to the application entry file. The system will resolve the module, controller and action of the current request from the URL parameter. The default URL MODE is query_string mode, which guarantees the highest compatibility.

http://example.com/index.php?_i=route(/params) query_string MODE http://example.com/route(/params) path_info MODE

This document used path_info mode to explain, no longer elaborate query_string mode

Clone this wiki locally