Skip to content

Commit db685b7

Browse files
committed
docs: add "Hosting with Subfolder"
1 parent 6cedbe9 commit db685b7

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

user_guide_src/source/installation/running.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,86 @@ The above configuration assumes the project folder is located as follows:
182182
│ └── public/ (DocumentRoot for myproject.local)
183183
└── htdocs/
184184
185+
Restart Apache.
186+
185187
Testing
186188
-------
187189

188190
With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser.
189191

190192
Apache needs to be restarted whenever you change its configuration.
191193

194+
Hosting with Subfolder
195+
======================
196+
197+
If you want a baseURL like **http://localhost/myproject/** with a subfolder,
198+
there are three ways.
199+
200+
Making Symlink
201+
--------------
202+
203+
Place your project folder as follows, where **htdocs** is the Apache document root::
204+
205+
├── myproject (project folder)
206+
│ └── public
207+
└── htdocs
208+
209+
Navigate to the **htdocs** folder and create a symbolic link as follows::
210+
211+
> cd htdocs/
212+
> ln -s ../myproject/public/ myproject
213+
214+
Using Alias
215+
-----------
216+
217+
Place your project folder as follows, where **htdocs** is the Apache document root::
218+
219+
├── myproject (project folder)
220+
│ └── public
221+
└── htdocs
222+
223+
Add the following in the main configuration file, e.g., **apache2/conf/httpd.conf**:
224+
225+
.. code-block:: apache
226+
227+
Alias /myproject /opt/lamp/apache2/myproject/public
228+
<Directory "/opt/lamp/apache2/myproject/public">
229+
AllowOverride All
230+
Require all granted
231+
</Directory>
232+
233+
Restart Apache.
234+
235+
Adding .htaccess
236+
----------------
237+
238+
The last resort is to add **.htaccess** to the project root.
239+
240+
It is not recommended that you place the project folder in the document root.
241+
However, if you have no other choice, like on a shared server, you can use this.
242+
243+
Place your project folder as follows, where **htdocs** is the Apache document root,
244+
and create the **.htaccess** file::
245+
246+
└── htdocs
247+
└── ci436 (project folder)
248+
├── .htaccess
249+
└── public
250+
251+
And edit **.htaccess** as follows:
252+
253+
.. code-block:: apache
254+
255+
<IfModule mod_rewrite.c>
256+
RewriteEngine On
257+
RewriteRule ^(.*)$ public/$1 [L]
258+
</IfModule>
259+
260+
<FilesMatch "^\.">
261+
Require all denied
262+
Satisfy All
263+
</FilesMatch>
264+
192265
Hosting with mod_userdir (Shared Hosts)
193266
=======================================
194267

0 commit comments

Comments
 (0)