Configuring WordPress .htaccess to view subfolders

后端 未结 2 2019
臣服心动
臣服心动 2020-12-01 13:02

I have a WordPress installation with an .htaccess file that looks like this:

# BEGIN WordPress

RewriteEngine On
R         


        
相关标签:
2条回答
  • 2020-12-01 13:33

    For future reference, you may want to try this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog2/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog2/index.php [L]
    </IfModule>
    # END WordPress
    
    0 讨论(0)
  • 2020-12-01 13:37

    Edit#2: ok i think i figured this out, but it's pretty messy.

    modify your base wordpress install's .htaccess file to look like this:

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

    now, load a new copy of wordpress into "blog2/", and copy your wp-config.php file over to it. edit the "/blog2/wp-config.php" file and change the $table_prefix to something different than your first blog. (this will install both wordpresses into the same database).

    once you've done that, you should be able to go to:

    http://yourdomain.com/blog2/
    

    and finish up the installation without issue. the initial problem was that the new copy of wordpress kept trying to use the first copy's wp-config.php file. moving it over manually fixed that all up.

    because i'm insane, i tested this with two fresh copies, wrote a few test articles, and was able to navigate around without issue, so it should work :)

    0 讨论(0)
提交回复
热议问题