admin管理员组

文章数量:1435859

we have wordpress main site on domain now we did copy of the site and put in the sub-folder domain/blog we did all necessary url changes. but it seems we have issues with .htaccess file.. the domain/blog is redirected to domain

this is what .htaccess in root

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

this is what .htaccess in /blog folder

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress

whats wrong with them? thanks a lot

we have wordpress main site on domain now we did copy of the site and put in the sub-folder domain/blog we did all necessary url changes. but it seems we have issues with .htaccess file.. the domain/blog is redirected to domain

this is what .htaccess in root

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

this is what .htaccess in /blog folder

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress

whats wrong with them? thanks a lot

Share Improve this question edited Mar 28, 2019 at 10:30 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Mar 27, 2019 at 8:43 AdamoAdamo 2
  • 1 WordPress have this well documented: codex.wordpress/Giving_WordPress_Its_Own_Directory – Kinnectus Commented Mar 27, 2019 at 9:16
  • Maybe you left the old .htaccess in the root dir? Or some too cramped SSL RewriteRule? Or you site's Apache conf? – norman.lol Commented Mar 27, 2019 at 17:29
Add a comment  | 

2 Answers 2

Reset to default 1

Your .htaccess looks just fine, but you need to tell WordPress itself that it got moved. Simply put the following line into your wp-config.php, then access your site's login page under the new URL and login. After that you can remove this line.:

define('RELOCATE', TRUE);

Alternatively add the following two lines to your wp-config.php, then navigate through the site a few pages far, then you can remove these lines.

define('WP_HOME', 'http://domain/blog');
define('WP_SITEURL', 'http://domain/blog');

Source: Changing The Site URL.

You need to Re-Check following two:

  1. SITEURL and Home in database table wp_options

  2. settings in wp-config.php

    To learn more about check WordPress documentation

本文标签: installationWordpress in subfolder dont work