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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?