Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
Wordpress in subfolder insists on showing the parent directory's contents

I'm attempting to migrate our wordpress blog from blog.ourdomain.co.uk to ourdomain.co.uk/journal, but ourdomain.co.uk/journal always shows the content from ourdomain.co.uk/.

To keep the migration simple, I started with a blank wordpress install in /journal, then imported 'All Content' using WP's built in export/import features.

All seemed well at first, but when I visit ourdomain.co.uk/journal it does not show a wordpress home page, but instead the home page of our main site. Even visiting ourdomain.co.uk/journal/index.php results in this behaviour. This site issues a 301 to redirect to ourdomain.co.uk/journal, and then I see the main site homepage rather than wordpress.

I can't see anything in the parent directory .htaccess file which would make this happen. The wordpress .htaccess file contains the code as per below, most of which was auto-created by wordpress, but I added the wp-admin redirect rule.

I can visit and use https://www.ourdomain.co.uk/journal/wp-admin/ no problem. Database cxn is OK. I can also visit static files such as https://www.ourdomain.co.uk/journal/readme.html. Links direct to posts also work fine, such as https://www.ourdomain.co.uk/journal/2021/post-title-here/ - it's just the homepage.

Even if I set the home page to be a static page, such as our about page in wordpress, this still happens.

I have defined define('WP_HOME', 'https://www.ourdomain.co.uk/journal'); and define('WP_SITEURL', 'https://www.ourdomain.co.uk/journal'); in wp-config.php

If I delete the contents of the /journal .htaccess file, then I am able to load https://www.ourdomain.co.uk/journal ONCE, then it goes wrong again because wordpress has rewritten the rewrite code to .htaccess - so clearly this is something to do with permalinks, but I'm unable to figure out what, exactly, the deal is.

Any help gratefully received.

Contents of .htaccess:

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /journal/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /journal/index.php [L]
</IfModule>

# END WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^wp-admin\/?$ wp-admin/index.php [NC]
</IfModule>
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

OK, has worked for 24 hours now so: fixed by adding 'DirectoryIndex index.php' to .htaccess. Looks like redirection was just going up the folder tree until it found a directory index page it recognised, so making it recognise the one in /journal fixed it.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda