使用zend

时间:2016-04-30 15:11:55

标签: .htaccess zend-framework

我正在尝试在此link上关注zend框架的使用入门:骨架应用程序。我正在使用xampp作为主机。

我做了什么

在文档之后,我在github下载了.zip骨架教程文件,并将提取的文件放在此路径中

  

C:\ XAMPP \ htdocs中\实践\ ZF2教程

使用gitbash composer我直接从给定路径运行composer install并成功安装其依赖项。

httpd.conf文件中我添加了此

<VirtualHost *:80>
       DocumentRoot "C:/xampp/htdocs/"
       ServerName localhost </VirtualHost> <VirtualHost *:80>
     DocumentRoot C:/xampp/htdocs/practice/zf2-tutorial/public
     ServerName xf2-tutorial.localhost
     SetEnv APPLICATION_ENV "development"
     <Directory C:/xampp/htdocs/practice/zf2-tutorial/public>
         DirectoryIndex index.php
         AllowOverride All
         Require all granted
     </Directory>  </VirtualHost>

并在此位置host的{​​{1}}文件中添加了此

  

127.0.0.1 xf2-tutorial.localhost

重启apache后,访问此

  

http://xf2-tutorial.localhost/

在浏览器中成功呈现index.page,但是当我尝试访问

  

http://xf2-tutorial.localhost/1234

我得到404错误,我做了什么,我检查了.htaccess如果正确,这是htaccess的内容

c:\windows\system32\drivers\etc\

我添加了这个,

RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

但我仍然得到404错误

任何想法,该怎么办?

0 个答案:

没有答案