duanhuan6336 2015-10-10 13:44
浏览 49
已采纳

超薄路由无法在服务器上运行

I'm creating REST API in php slim framework and i was using it just fine. Locally everything is running perfect but I'm having trouble with running it online. I have server from university where there are a lot of student projects so route to my rest api is:

/var/www/projects/myProject/bpsql

In bpsql folder there are public, vendor and app folder with composer.json file. In my public file there is htaccess file which is causing trouble (I think). How should that file look, do you think i should change something from this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

I tried with adding line RewriteBase projects/myproject/bpsql/publicbut nothing has worked.

Any help would be greatly appreciated!

Edit:

apache modules on server got by `print_r(apache_get_modules());



     Array
(
    [0] => core
    [1] => mod_log_config
    [2] => mod_logio
    [3] => mod_version
    [4] => prefork
    [5] => http_core
    [6] => mod_so
    [7] => mod_alias
    [8] => mod_auth_basic
    [9] => mod_authn_file
    [10] => mod_authz_default
    [11] => mod_authz_groupfile
    [12] => mod_authz_host
    [13] => mod_authz_user
    [14] => mod_autoindex
    [15] => mod_cgi
    [16] => mod_deflate
    [17] => mod_dir
    [18] => mod_env
    [19] => mod_mime
    [20] => mod_negotiation
    [21] => mod_php5
    [22] => mod_reqtimeout
    [23] => mod_rewrite
    [24] => mod_setenvif
    [25] => mod_ssl
    [26] => mod_status
)
/var/www    //echo getenv("DOCUMENT_ROOT") ;
  • 写回答

2条回答 默认 最新

  • dongtang5776 2015-10-12 19:37
    关注

    Ok, figured the problem so if someone in future encounters same problem, this fixed it for me:

    1. Enabling rewrite module in apache (Martin's answer)
    2. In httpd conf file i changed AllowOverRide None to AllowOverride All

    Special thanks to @David Pastore for all the help and assistance in figuring out the problem.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装