我通过我的Windows机器上的zf.bat创建了一个简单的Zend Framework 1.12测试应用程序(xampp,php5.3):“zf create project testapp”
之后我在'IndexController'旁边创建了一个名为'FoobarController'的新控制器。 现在我可以在这些网址之间切换:
localhost/projects/testapp/public/
localhost/projects/testapp/public/index
localhost/projects/testapp/public/foobar
现在我已将整个testapp上传到我的覆盆子pi(192.168.1.100,Apache2,PHP5.3,ModRewite On,AllowOverride All)的web服务器目录中。
当我从windows机器调用树莓时,这个网址工作正常:
192.168.1.100/sites/testapp/public
192.168.1.100/sites/testapp/public/foobar
这个将显示:“在此服务器上找不到请求的URL / sites / testapp / public / index ”
192.168.1.100/sites/testapp/public/index
有人知道为什么“索引”控制器的网址在我的树莓上无法正常工作吗? (我只做了解释的步骤)
的/ etc / apache2的/位点可用/默认值:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
htaccess的:
RewriteEngine On
RewriteBase /sites/testapp/public
# 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 ^(/.+)(.+)::$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]