-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
The current .htaccess config allows only one-level access. For example, index.php, Rest.php, and .htacess can't be under /var/www/myweb/rest/, nor can they be in a directory other than /var/www/. The latter is often the case for virtualhost configurations.
An easy fix is to add RewriteBase directive to .htaccess or in virtualhost config in /etc/apache2/sites-available/default. An example of virtualhost url is as below:
<VirtualHost *:80>
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
... ...
Alias /wsrest/ "/opt/test/rest/examples/"
<Directory /opt/test/rest/examples/>
RewriteEngine On
RewriteBase /wsrest/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php?RESTurl=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ index.php [QSA,NC,L]
</Directory>
By default, RewriteBase points to /var/www, but above setting lets Apache2 know it should use alias /wsrest/, instead of physical location /var/www.
Hope it helps.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels