我是PHP新手,我面临着一些问题。
我正在使用EasyPHP (DevServer 14.1 -> PHP5.5.8和Apache2.4.7)和CakePHP (2.5.1)。
如果我把CakePHP文件放在"C:\Program \EasyPHP\data\localweb\“(然后是"C:\Program .”)(例如),它工作正常,就像它应该做的那样。
问题是:我想在EasyPHP上使用别名,因为我不想在"C:\Program .“中进行开发。但是当我将CakePHP文件放到我的应用程序根目录(“C:\myapps\myproject.”)时例如,如果在EasyPHP上设置了一个别名,那么我就会得到一个"Error 404“。现在,我发现如果从根中删除.htaccess文件,它就能工作。但是我确信这个文件是出于某种原因而存在的,所以我觉得删除它是不对的--它以后可能会给我带来更多的问题。
有人知道这事吗?如果我想使用EasyPHP,可以在CakePHP上使用别名吗?提前谢谢。
编辑的
这是我的apache_alias.conf (C:\Program \EasyPHP-DevServer-14.1VC11\data\conf):
Alias "/cakeblogtutorial" "C:/Programacao/PHP/workspace/CakeBlogTutorial"
<Directory "C:/Programacao/PHP/workspace/CakeBlogTutorial">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>这是我的(C:\Programacao\PHP\workspace\CakeBlogTutorial):.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>在我的Files\EasyPHP-DevServer-14.1VC11\binaries\conf_files),(C:\Program httpd.conf to mod_rewrite )上(换句话说,未注释):
LoadModule rewrite_module modules/mod_rewrite.so关于Files\EasyPHP-DevServer-14.1VC11\binaries\apache\logs):的最后一行(C:\Program error.log )
[Mon Jun 02 14:27:48.093057 2014] [:error] [pid 4284:tid 848] [client 127.0.0.1:62831] script 'C:/Program Files/EasyPHP-DevServer-14.1VC11/data/localweb/index.php' not found or unable to stat
[Mon Jun 02 14:34:59.319532 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00424: Parent: Received restart signal -- Restarting the server.
[Mon Jun 02 14:34:59.982390 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00455: Apache/2.4.7 (Win32) PHP/5.5.8 configured -- resuming normal operations
[Mon Jun 02 14:34:59.982390 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00456: Apache Lounge VC11 Server built: Nov 21 2013 20:13:01
[Mon Jun 02 14:34:59.982390 2014] [core:notice] [pid 1992:tid 312] AH00094: Command line: 'C:\\PROGRA~1\\EASYPH~1.1VC\\binaries\\apache\\bin\\eds-httpd.exe -d C:/Program Files/EasyPHP-DevServer-14.1VC11/binaries/apache'
[Mon Jun 02 14:34:59.988391 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00418: Parent: Created child process 6588
[Mon Jun 02 14:35:01.279844 2014] [mpm_winnt:notice] [pid 6588:tid 364] AH00354: Child: Starting 64 worker threads.
[Mon Jun 02 14:35:01.523147 2014] [mpm_winnt:notice] [pid 4284:tid 364] AH00364: Child: All worker threads have exited.关于Files\EasyPHP-DevServer-14.1VC11\binaries\apache\logs):的最后一行(C:\Program access.log )
127.0.0.1 - - [02/Jun/2014:15:09:50 -0300] "GET /cakeblogtutorial HTTP/1.1" 301 242
127.0.0.1 - - [02/Jun/2014:15:09:50 -0300] "GET /cakeblogtutorial/ HTTP/1.1" 404 1156发布于 2014-06-04 12:46:06
我想我找到了答案--如果是这样的话,RewriteBase是正确的。来自CakePHP WebSite (http://book.cakephp.org/2.0/en/installation/url-rewriting.html):
对于许多托管服务(GoDaddy,1和1),您的web服务器实际上是从已经使用mod_rewrite的用户目录中获得的。如果要将CakePHP安装到用户目录(http://example.com/~username/cakephp/)或任何其他已经使用mod_rewrite的URL结构中,则需要将RewriteBase语句添加到CakePHP使用的.htaccess文件(/.htaccess,/app/..htaccess,/app/webroot/..htaccess)中。
https://stackoverflow.com/questions/23946135
复制相似问题