Silverstripe安装 - 友好URL不起作用

问题描述 投票:0回答:1

我试图在两个不同的服务器上安装silverstripe 4.2.1并在安装时遇到同样的错误。今年我在其他客户机上安装了多个,但这是我第一次遇到这个问题。想知道它是否是4.2.1问题

安装时出现错误消息

友好的URL无效。这很可能是因为您的站点上未正确配置重写模块。您可能需要让您的Web主机或服务器管理员为您执行此操作:

在您的Web服务器上启用了mod_rewrite或其他重写模块 为安装SilverStripe的目录设置AllowOverride All

我在root,public_html和silverstripe公共文件夹中的.htaccess中放置了一些垃圾文本。这三个都导致500错误。

请注意,我能够访问site.com并将其重定向到安装程序。所以我认为mod_rewrite确实启用了。

当我访问site.com时,它提供了“服务器错误”的silverstripe版本

我的HTAccess文件位于SS的公共文件夹中:

    ### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)
<Files *.ss>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Files>

# Deny access to IIS configuration
<Files web.config>
    Order deny,allow
    Deny from all
</Files>

# Deny access to YAML configuration files which might include sensitive information
<Files ~ "\.ya?ml$">
    Order allow,deny
    Deny from all
</Files>

# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>

    # Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
    <IfModule mod_dir.c>
        DirectoryIndex disabled
        DirectorySlash On
    </IfModule>

    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine On
    RewriteBase '/public'

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


    # Deny access to potentially sensitive files and folders
    RewriteRule ^vendor(/|$) - [F,L,NC]
    RewriteRule ^\.env - [F,L,NC]
    RewriteRule silverstripe-cache(/|$) - [F,L,NC]
    RewriteRule composer\.(json|lock) - [F,L,NC]
    RewriteRule (error|silverstripe|debug)\.log - [F,L,NC]

    # Process through SilverStripe if no file with the requested name exists.
    # Pass through the original path as a query parameter, and retain the existing parameters.
    # Try finding framework in the vendor folder first
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* index.php
</IfModule>
### SILVERSTRIPE END ###

和public_html中的那个

RewriteEngine On
RewriteRule ^(.*)$ public/$1

我在共享服务器上运行PHP7.1。

silverstripe silverstripe-4
1个回答
1
投票

我想在这里发帖,以防其他人遇到这个问题。它困扰了我4天,似乎没有人得到答案。

如果您通过将源解压缩到public_html或通过编写器将SS安装在共享主机帐户上,则可能会在安装时遇到错误。

无法编写友好的URL - 检查mod_rewrite是否已启用且AllowOveride是否设置为All。

我知道在与技术支持人员交谈之后,这两个人实际上都在发生。

在安装错误后访问该站点时,我会在一些测试后发现服务器错误,可能会发现该站点确实正在按照SS的意图重写/ public。

最后我注意到/public中的index.php拥有775的权限。我把它改为644,一切都很好。

注意:我尝试在两个不同的托管服务提供商上安装v4.2.1。 BlueHost(对作曲家有ssh访问权限)和Hostgator(没有ssh)两者都给了我同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.