Php SSL安装后“;“未找到页面”;除了使用Symfony2的Apache主页外,每个页面上都有错误

Php SSL安装后“;“未找到页面”;除了使用Symfony2的Apache主页外,每个页面上都有错误,php,apache,.htaccess,symfony,ssl,Php,Apache,.htaccess,Symfony,Ssl,我的.htaccess文件代码是 # Use the front controller as index file. It serves as a fallback solution when # every other rewrite/redirect fails (e.g. in an aliased environment without # mod_rewrite). Additionally, this reduces the matching process for the # st

我的.htaccess文件代码是

# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Determine the RewriteBase automatically and set it as environment variable.
    # If you are using Apache aliases to do mass virtual hosting or installed the
    # project in a subdirectory, the base path will be prepended to allow proper
    # resolution of the app.php file and to redirect to the correct URI. It will
    # work in environments without path prefix as well, providing a safe, one-size
    # fits all solution. But as you do not need it in this case, you can comment
    # the following 2 lines to eliminate the overhead.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Redirect to URI without front controller to prevent duplicate content
    # (with and without `/app.php`). Only do this redirect on the initial
    # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
    # endless redirect loop (request -> rewrite to front controller ->
    # redirect -> request -> ...).
    # So in case you get a "too many redirects" error or you always get redirected
    # to the start page because your Apache does not expose the REDIRECT_STATUS
    # environment variable, you have 2 choices:
    # - disable this feature by commenting the following 2 lines or
    # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
    #   following RewriteCond (best solution)
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/index.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /index.php/
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>
#将前控制器用作索引文件。在以下情况下,它可作为备用解决方案:
#每隔一次重写/重定向都会失败(例如,在没有
#修改(重写)。此外,这还减少了对象的匹配过程
#起始页(路径“/”),否则Apache将应用重写规则
#到每个配置的DirectoryIndex文件(例如index.php、index.html、index.pl)。
DirectoryIndex.php
重新启动发动机
#自动确定RewriteBase并将其设置为环境变量。
#如果您使用Apache别名进行大规模虚拟托管或安装
#在子目录中的项目中,将在基本路径前面加上前缀,以允许正确的
#解析app.php文件并重定向到正确的URI。会的
#也可以在没有路径前缀的环境中工作,提供一个安全的单一大小
#适用于所有解决方案。但是,在这种情况下,您不需要它,您可以进行评论
#以下两条线路可消除开销。
RewriteCond%{REQUEST_URI}:$1^(/.+)/(.*):\2$
重写规则^(.*)-[E=基:%1]
#重定向到不带前端控制器的URI以防止重复内容
#(带或不带“/app.php”)。仅在初始路径上执行此重定向
#由Apache重写,而不是在后续周期中重写。否则我们会被解雇
#无休止的重定向循环(请求->重写到前端控制器->
#重定向->请求->…)。
#所以,如果你得到一个“太多重定向”错误或你总是得到重定向
#因为您的Apache没有公开重定向的状态,所以无法访问起始页
#环境变量,您有两种选择:
#-通过注释以下两行或两行禁用此功能
#-使用Apache>=2.3.9,用结束标志替换所有L标志,并删除
#第二步(最佳解决方案)
RewriteCond%{ENV:REDIRECT_STATUS}^$
重写规则^index\.php(/(.*)|$)%{ENV:BASE}/$2[R=301,L]
#如果请求的文件名存在,只需提供它即可。
#我们只想让Apache服务于文件,而不是目录。
RewriteCond%{REQUEST_FILENAME}-f
重写规则[L]
#将所有其他查询重写到前端控制器。
重写规则.?%{ENV:BASE}/index.php[L]
#当mod_rewrite不可用时,我们指示临时重定向
#将起始页显式地发送到前端控制器,以便网站
#生成的链接仍然可以使用。
重定向匹配302^/$/index.php/
#不能改为使用RedirectTemp
我的域名链接

但当我点击链接时,它正确地显示了主页,但在菜单内的每个页面中,它都显示了错误。因为所有菜单URL都是使用Symfony2路由动态生成的

如果URL像新闻网站文章的URL一样动态生成,那么.htaccess配置是什么


请大家帮帮我

尝试更改Apache配置文件:

<VirtualHost *:80>
    ServerAdmin admin@yoursite.com
    ServerName yoursitename.com
    ServerAlias www.yoursitename.com
    DocumentRoot /home/admin/projects/yoursite
    <Directory "/home/admin/projects/yoursite/web/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/yousite_error.log
    CustomLog ${APACHE_LOG_DIR}/yousite_access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

服务器管理员admin@yoursite.com
ServerName yoursitename.com
服务器别名www.yoursitename.com
DocumentRoot/home/admin/projects/yoursite
选项索引跟随符号链接多视图
允许超越所有
要求所有授权
ErrorLog${APACHE\u LOG\u DIR}/yousite\u error.LOG
CustomLog${APACHE\u LOG\u DIR}/yousite\u access.LOG组合
#vim:syntax=apachets=4sw=4sts=4srnoet

如果这不起作用,您必须查看Apache2错误文件。例如,虚拟主机设置中的
/var/log/apache2/yousite\u error.log

<VirtualHost *:443>
                ServerAdmin webmaster@localhost
                DocumentRoot /var/www/html/project
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile /etc/apache2/ssl/certificate.pem
                SSLCertificateKeyFile /etc/apache2/ssl/privatekey.pem
        <Directory /var/www/html/project>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

服务器管理员webmaster@localhost
DocumentRoot/var/www/html/project
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
斯伦金安
SSLCertificateFile/etc/apache2/ssl/certificate.pem
SSLCertificateKeyFile/etc/apache2/ssl/privatekey.pem
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融

该错误是由于您的项目目录的权限问题造成的。添加部分解决了我的问题。

没有SSL链接的情况下,起始页index.php或app.php的名称是什么?起始页是index.php&在这个文件中,我添加了包含在app.php文件中的代码。你能显示apache2配置文件或Nginx配置文件吗?我使用了apache2。但除了我的项目文件外,我无法访问服务器文件。