简体   繁体   中英

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. I am trying now setting up a new one on a url like example.com/wordpress. For this I added in 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.

Accessing https://example.com/wordpress redirects to https://example.com/wordpress/wp-admin/install.php as expected for the first access

But then https://example.com/wordpress/wp-admin/install.php keeps redirecting to itself. With the header x-redirect-by: WordPress

I think some configuration in Wordpress is still missing.

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. 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)

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM