简体   繁体   English

在像 example.com/wordpress 这样的 url 上设置 wodpress 的配置是什么?

[英]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.

相关问题 像groovehark / twitter这样友好的网址:example.com/#!/whatever - Friendly URL like grooveshark/twitter: example.com/#!/whatever 使用example.com/blog?p=1234将URL重定向到wordpress默认URL(example.com/blog/actual-url-of-post)在Safari中不起作用 - Redirect URL's with example.com/blog?p=1234 to wordpress default URL (example.com/blog/actual-url-of-post) doesn't work in Safari Apache 2阻止网址,例如example.com/?admin - Apache 2 block url such as example.com/?admin 如何从像“example.com/products/123/title-of-this-product”这样干净的 url $_GET['id']? - How to $_GET['id'] from a clean url like "example.com/products/123/title-of-this-product"? 如何将example.com/index.php#anchor的URL重写为example.com/anchor? - How do I rewrite the URL for example.com/index.php#anchor to example.com/anchor? 如何处理从example.com/search/?s=some到example.com/search/some的URL - How to manipulate the URL from example.com/search/?s=some to example.com/search/some 在以下链接中实现斜杠:example.com/parameter - Implementing slash in links like: example.com/parameter 基本网址(例如example.com)在NGinx中不起作用 - Base URLs like example.com not working in NGinx 将example.com/out/1234重定向到另一个URL - Redirect example.com/out/1234 to another URL 传递example.com时,parse_url()返回错误 - parse_url() returns an error when example.com is passed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM