[英]What is the configuration for setting up wodpress on a url like example.com/wordpress?
I have a Wordpress set up on a url like example.com.我在 url 上设置了 Wordpress,例如 example.com。 I am trying now setting up a new one on a url like example.com/wordpress.我现在正在尝试在 url 上设置一个新的,例如 example.com/wordpress。 For this I added in wp-config.php
为此,我添加了wp-config.php
define( 'WP_HOME', 'https://example.com/wordpress' );
define( 'WP_SITEURL', 'https://example.com/wordpress' );
But I am getting an infinite 302 redirect loop.但我得到了一个无限的 302 重定向循环。
Accessing https://example.com/wordpress
redirects to https://example.com/wordpress/wp-admin/install.php
as expected for the first access访问https://example.com/wordpress
重定向到https://example.com/wordpress/wp-admin/install.php
如预期的第一次访问
But then https://example.com/wordpress/wp-admin/install.php
keeps redirecting to itself.但是随后https://example.com/wordpress/wp-admin/install.php
不断重定向到自己。 With the header x-redirect-by: WordPress
使用 header x-redirect-by: WordPress
I think some configuration in Wordpress is still missing.我认为 Wordpress 中的一些配置仍然缺失。
If you have a separate WordPress install in the root directory, then the .htaccess files of your subdirectory will cause conflict and result in 404 errors.如果你有单独的WordPress安装在根目录下,那么你的子目录下的.htaccess文件会引起冲突,导致404错误。 Therefore, you'll need to edit the .htaccess file in your subdirectory WordPress installation and replace the code with the following code (replace /subdirectory/ with your own subdirectory name)因此,您需要在您的子目录 WordPress 安装中编辑 .htaccess 文件并将代码替换为以下代码(将 /subdirectory/ 替换为您自己的子目录名称)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /your-subdirectory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.