Unable to access PhpMyAdmin when cakephp in installed in the server

纵然是瞬间 提交于 2019-12-12 13:35:12

问题


I am trying to transfer my codes from localhost to a live domain. The directory of the server is like this:

-www.example.com
 --app
 --cake
 --vendors
 --plugins
 -- phpMyAdmin
 -- htaccess

Since cakephp deals with the URL, when i try to access www.example.com/phpMyAdmin, cakephp complains that "PhpmyAdminController could not be found". I tried to change the htaccess in the app/webroot/htaccess to allow url of phpMyAdmin but it does not work. Can someone help?

I followed the tutorial from the following website: http://cakebaker.42dh.com/2006/08/17/take-over-the-control-of-some-urls-from-cakephp/. However i changed the htaccess in the webroot folder rather than the main folder.

I am really hoping for someone to help.


回答1:


You can do it by modifying the .htaccess file which is located outside app folder. Please try with this. I'm using this particular code and its working for me.

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

Now you'll be able to run a directory like this http://example.com/phpmyadmin




回答2:


you can put the phpMyAdmin folder in app/webroot/ . Access using the same url (with a slash at the end) www.example.com/phpMyAdmin/




回答3:


I guess i had managed to find the answer and the best way to do without duplicating the phpmyadmin will be:

<IfModule mod_rewrite.c>
   RewriteEngine on
   rewritecond %{REQUEST_URI} ^/(phpMyAdmin)/
   RewriteRule .* - [S=2] 
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

The above htaccess must be changed in the root directory of the cake and not the webroot. I do not want to take the credit and the credit goes to the participant of the forum at the following url:

http://cakephp.1045679.n5.nabble.com/Routing-to-an-external-application-td1274772.html



来源:https://stackoverflow.com/questions/7446842/unable-to-access-phpmyadmin-when-cakephp-in-installed-in-the-server

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