I have a website hosted in /var/www/thesite
(apache server), it's a Symfony2
website so inside this folder I have a web
folder to which my virtual host is pointing.
So my virtualhost is www.mysite.com -> /var/www/thesite/web
In this web folder I have a .htaccess
to format URL nicely.
Now, I've added an API in /var/www/thesite/api
, the API is implemented using Silex
.
I want to redirect all request http://www.mysite.com/api
to this new framework.
So I've added in /var/www/thesite/web/.htaccess
RewriteCond %{REQUEST_URI} ^/api
RewriteRule ^api(.*)$ ../api/web/index.php [NC,QSA,L]
But I get:
Bad Request
Your browser sent a request that this server could not understand.
I'm not sure if I can access parent folder in the .htaccess
. I don't want to change my virtualhost target directory to avoid security breach.
How can I solve this issue?
api
under/var/www/thesite/web
? – Dueweb
is accessible publicly. you don't want your source code accessible. – Tetrameter