微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Silverstripe 4.7.3 htaccess 重定向问题

如何解决Silverstripe 4.7.3 htaccess 重定向问题

也许这里有人使用 silverstripe 4.7.3 可以帮助我。

我对一种解决方案有疑问。我需要在不同的 URL 地址显示某个页面 例如:

测试?代码=1234 我使用get中的代码从db下载一些记录,这个页面是在cms中创建的,这个页面链接是/test。并且此页面正常工作。

但现在我想在另一个 URL 上显示页面,该 URL 应如下所示: /test-1234/

RewriteRule ^test-(\d{4})/(([\sąćęłńóśźżĄĆĘŁŃÓŚŹŻa-zA-Z0-9_-])*)(\/)? /test/?code=$1&code=$2&%{QUERY_STRING} [L]

我发现 htaccess 中的这条规则没有得到满足,但我检查了标志 R=301 并且这条规则有效有人可以解释我为什么没有 R=301 的规则只有 [L] 不能与原始 htaccess 一起使用?我包括完整的文件

<Files web.config>
    Require all denied
</Files>

# Deny access to YAML configuration files which might include sensitive information
<Files ~ "\.ya?ml$">
    Require all denied
</Files>

# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
#ErrorDocument 503 /assets/error-503.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

    RewriteRule ^test-(\d{4})/(([\sąćęłńóśźżĄĆĘŁŃÓŚŹŻa-zA-Z0-9_-])*)(\/)? /test/?code=$1&code=$2&%{QUERY_STRING} [L]

    # Process through SilverStripe if no file with the requested name exists.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* index.PHP

    # Enable HTTP Basic authentication workaround for PHP running in CGI mode
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

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

</IfModule>
### SILVERSTRIPE END ### ```



版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。