我找了又找,问过了,没有joy.
布卢夫: 在我使用Bluehost ApacheWordPress作为后端的Reaction Headless CMS上,当我刷新一个不是根目录的页面时,我得到了一个页面找不到错误.
我已try 将htaccess文件修改为.html,而不是.php 这里有两个问题:
- 对我的自定义终结点的任何请求都不再起作用
- 如果我在wp-admin上保存固定链接,则htaccess文件将恢复为.php
当.htaccess文件为.php时,My Site使用定制REST API工作得很好,但重新加载除根目录以外的任何页面都会导致页面未找到错误.
如果有帮助的话,我正在我的Reaction应用程序上使用BrowserRouter.
先谢谢你.
我已经将我的.htaccess文件修改为.index,而不是没有joy的.php
HTAccess内容:
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 hour"
ExpiresByType image/jpeg "access plus 1 hour"
ExpiresByType image/gif "access plus 1 hour"
ExpiresByType image/png "access plus 1 hour"
ExpiresByType text/css "access plus 1 hour"
ExpiresByType application/pdf "access plus 6 hours"
ExpiresByType text/javascript "access plus 1 hour"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 5 minutes"
</IfModule>
Options -Indexes
<IfModule mod_headers.c>
Header set X-Endurance-Cache-Level "1"
Header set X-nginx-cache "WordPress"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
AddHandler application/x-httpd-ea-php82___lsphp .php
# BEGIN LiteSpeed
# The directives (lines) between "BEGIN LiteSpeed" and "END LiteSpeed" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule Litespeed>
SetEnv noabort 1
</IfModule>
# END LiteSpeed
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php81” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php81___lsphp .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
#My custom code
#End my custom code
IMtry 到达的示例路由是home epage.com/wp-json/myapp/v1/end