【问题标题】:Trailing slash at end of URL wordpress / Blank PageURL wordpress /空白页末尾的斜杠
【发布时间】:2018-10-17 17:23:13
【问题描述】:

我在我的 wordpress 上检查了一个问题。在浏览域页面根https://domain1.com 时,如果在末尾添加一个斜杠,就像这样https://domain1.com/ 它会给出一个空白页面。 如果删除尾部斜杠,它会打开正常。有什么解决办法吗?

另一方面,如果打开任何没有斜杠的页面,我就会有一个空白页面。示例:https://domain1.com/page1,但如果我添加一个结尾斜杠,它会正常打开,如下所示:https://domain1.com/page1/

我确信这可以通过正确的 .htaccess 文件来解决,只是不确定哪些设置。

这就是我所拥有的:

RewriteEngine on

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

感谢您的帮助!

【问题讨论】:

  • 这取决于http服务器是如何配置的。

标签: trailing-slash


【解决方案1】:

没关系,解决了。 我就是这样做的: 在我的 htaccess 上添加了错误日志文件记录:

# enable PHP error logging
php_flag  log_errors on
php_value error_log  /home/myuser/public_html/PHP_errorsX1.log

# prevent access to PHP error log
<Files PHP_errorsX1.log>
Order allow,deny
Deny from all
Satisfy All
</Files>

然后,检查错误日志。它在functions.php文件上显示了一些错误:

[21-Oct-2018 14:54:05 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/myuser/public_html/wp-content/themes/mytheme/functions.php:84) in /home/myuser/public_html/wp-includes/pluggable.php on line 1210

检查了该特定行,在关闭 php 代码后,它是文件底部的该死的空白行。删除了那个文件,现在一切都恢复了,包括我得到的 WP ADMIN 上的一些愚蠢的随机空白页错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-27
    • 1970-01-01
    • 2016-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-22
    • 2011-02-18
    相关资源
    最近更新 更多