簡體   English   中英

如何在Windows中使用Xampp服務器在本地運行現有的Cake php項目

[英]How to run an existing cake php project in my local using xampp server in windows

這是我的webroot .htaccess文件

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{SERVER_PORT} 80 
    RewriteBase http://localhost/myproject/$1 [R=301,L]
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^ index.php [L]
</IfModule>

這是項目文件夾.htaccess文件

<IfModule mod_rewrite.c>
    #RewriteEngine on
    #RewriteRule    ^(\.well-known/.*)$ $1 [L]
    #RewriteRule    ^$    webroot/    [L]
    #RewriteRule    (.*) webroot/$1    [L]
    </IfModule>

該文件位於應用程序文件夾.htaccess文件中

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

有人可以幫我嗎?

嘗試以下htaccess代碼

/var/www/app/webroot/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

/var/www/app/.htaccess

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

/var/www/.htaccess

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

CakePHP應用程序中的500 Internal Server Error可能有以下原因:

1) Your .htaccess files are not correct.
2) Permissions of folders are not correct. If CakePHP app is Group Writable i.e. 777 then webserver gives 500 error for safety.
3) You are missing Database Connection. Correct database configuration according to Webhost because most of times local and production server databases have different details.
4) Delete the content of your tmp folder. It is best practice that you must delete cache if you move your application from one place to another.
5) For testing purpose debug should be on like configure::write('debug',2);
6) If not succeeded check your Apache Error Log. If using Linux /var/log/apache2/error.log

希望對您有所幫助,謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM