duanmengsuo9302 2016-02-05 12:35
浏览 46
已采纳

重定向到cakephp应用程序以外的其他文件夹

I have my cakephp application inside Myproject folder which I can access by using domain name eg. www.example.com. This website works properly.

But I have another folder called Webservices which contain web services written in php. I have placed this folder inside Myproject folder & and trying to access php script inside Webservices folder by using domain name www.example.com/weservices/phpscript.php but it gives error that controller not found.

I have made changes in .htaccess file but I am not able to reach the solution.

below is my .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

I am sure that we have to make changes in .htaccess file. can you please help me to write .htaccess file

  • 写回答

1条回答 默认 最新

  • dongren1986 2016-02-05 14:01
    关注

    You want to put your Webservices folder inside your app's webroot so that it can be accessed (this would be the easiest solution):-

    app/webroot/Webservices
    

    Anything outside of Cake's webroot is intentionally not accessible via the browser for security and messing with your .htaccess file to make it accessible may lead to you accidentally creating an unwanted vulnerability.

    Files/Folders in the webroot can be accessed from the browser as if they were in the root (assuming you have Cake correctly configured on your web server). So your script would be accessible at:-

    www.example.com/Webservices/phpscript.php
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀