htaccess redirect URI to parent directory

折月煮酒 提交于 2019-12-05 14:23:33

You can't route a request to outside of the site's document root, which is /var/www/thesite/web. So you can't access /var/www/thesite/ or /var/www/thesite/api from inside the /var/www/thesite/web directory. The 400 Bad request is because of the ../api/ bit of your rule's target.

Something you can try doing is just using php to include/require the api's index.php:

RewriteRule ^api/(.*)$ /index_api.php [L]

And in the index_api.php you can include or require the "../api/web/index.php" file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!