【问题标题】:symfony wrong index and auto redirect to xampp webpagesymfony 错误索引并自动重定向到 xampp 网页
【发布时间】:2011-06-03 16:45:51
【问题描述】:

我安装了 xampp,它在我的 symfony 上运行良好。我什至在项目上做了一些练习。 但是我无法设置从另一台 PC 复制的最新项目。

它看起来如何:网站在

中打开

http://localhost/ppz/chujwiecotobedzie/web/frontend_dev.php

看起来不错,但是当我制作

symfony cc

(以防万一)然后在

http://localhost/ppz/chujwiecotobedzie/web/

中打开时,页面将重定向到 xampp主页。

我使用 symfony 1.4 有前端和后端文件夹。我只在前端文件夹中工作。 我认为任何文件都可以使这种混乱,但我不知道。 请帮忙。

xamp-apache:

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host.localhost
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
    ##ServerName dummy-host.localhost
    ##ServerAlias www.dummy-host.localhost
    ##ErrorLog "logs/dummy-host.localhost-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
    ##ServerName dummy-host2.localhost
    ##ServerAlias www.dummy-host2.localhost
    ##ErrorLog "logs/dummy-host2.localhost-error.log"
    ##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>

Windows 主机:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

127.0.0.1 localhost

我正在使用带有已安装插件的 netbeans 7:php + symfony


edit1:我将路径从 myproject 更改为真正的路径 chu...

在 frontend_dev 打开的首页中,我可以看到 indexSuccess 中的文本:

但是,如果我单击任何链接,它会显示:


我是如何解决的: 1 将此目录更改为更短并放入另一个目录。 C:\www

2 在这个文件夹中,我把项目中的所有文件:应用程序、缓存等(如果你没有文件 'symfony' 你应该这样做,这样 symfony 会知道这是 symfony 目录项目)

3 c:\Windows\System32\drivers\etc\hosts 我只放了一个标志:127.0.0.1 localhost.tld

4 在 apache:C:\xampp\apache\conf\extra\ httpd vhost 我放: 名称VirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
 ServerName localhost.tld
 DocumentRoot "C:\www\web"
 DirectoryIndex index.php
 <Directory "C:\www\web">
 AllowOverride All
 Allow from All
 </Directory>
</VirtualHost>

netbeans 中的 5> 我的项目的属性 > 运行配置 > 项目 url > 我写道:http://localhost.ltd/

【问题讨论】:

    标签: symfony1 xampp redirect


    【解决方案1】:

    在我看来,这些文件夹之间存在混淆。

    frontend_dev.php 应该在 web/ 目录中

    如果 localhost/myproject/project1/frontend_dev.php 工作正常,那么应该可以在以下位置访问生产版本:

    localhost/myproject/project1/index.php

    【讨论】:

    • 在路径中:localhost/ppz/chujwiecotobedzie 它显示了源代码(所有文件)。如果我把 /index.php 说成找不到对象,因为索引在 web 文件夹中,对吧?
    • localhost/ppz/chujwiecotobedzie/web/frontend_dev.php 完美运行,但是在我单击任何链接后(例如,我实现了操作 executeBut 并在 butSuccess 中写入文本:测试)页面显示 404 找不到对象。在首页中显示的操作 executeIndex 中,我可以看到“测试”文本。怎么了?
    • @Michal Mokrzycki 你能再做一次编辑来显示你用来显示无效链接的代码吗?
    • 我发现错误,我必须在 apache 中使用特定的虚拟主机配置 vhost:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-10
    • 1970-01-01
    • 2011-07-11
    • 1970-01-01
    • 2019-07-05
    • 2015-08-23
    相关资源
    最近更新 更多