From 1d0b3d1a8602d27d20191892f982b87ee3abf452 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 11:06:42 +0900 Subject: [PATCH] docs: add "Hosting with Subfolder" --- .../source/installation/running.rst | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 7b763c5ae616..79b70fd96c60 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -171,6 +171,8 @@ e.g., **apache2/conf/extra/httpd-vhost.conf**: If your project folder is not a subfolder of the Apache document root, then your ```` element may need a nested ```` element to grant the web server access to the files. +Restart Apache. + Testing ------- @@ -178,6 +180,77 @@ With the above configuration, your webapp would be accessed with the URL **http: Apache needs to be restarted whenever you change its configuration. +Hosting with Subfolder +====================== + +If you want a baseURL like **http://localhost/myproject/** with a subfolder, +there are three ways. + +Making Symlink +-------------- + +Place your project folder as follows, where **htdocs** is the Apache document root:: + + ├── myproject (project folder) + │ └── public + └── htdocs + +Navigate to the **htdocs** folder and create a symbolic link as follows:: + + > cd htdocs/ + > ln -s ../myproject/public/ myproject + +Using Alias +----------- + +Place your project folder as follows, where **htdocs** is the Apache document root:: + + ├── myproject (project folder) + │ └── public + └── htdocs + +Add the following in the main configuration file, e.g., **apache2/conf/httpd.conf**: + +.. code-block:: apache + + Alias /myproject /opt/lamp/apache2/myproject/public + + AllowOverride All + Require all granted + + +Restart Apache. + +Adding .htaccess +---------------- + +The last resort is to add **.htaccess** to the project root. + +It is not recommended that you place the project folder in the document root. +However, if you have no other choice, like on a shared server, you can use this. + +Place your project folder as follows, where **htdocs** is the Apache document root, +and create the **.htaccess** file:: + + └── htdocs + └── ci436 (project folder) + └── .htaccess + └── public + +And edit **.htaccess** as follows: + +.. code-block:: apache + + + RewriteEngine On + RewriteRule ^(.*)$ public/$1 [L] + + + + Require all denied + Satisfy All + + Hosting with mod_userdir (Shared Hosts) =======================================