Index in Wordpress Subfolder

0

I am mounting a hotsite in php in subdirectory where WordPress is installed. But accessing the folder is giving me the error 404 , being that it has a index.php normally. I researched and could not find a way to resolve the issue. I would just like to access the folder normally www.meudominio.com.br/hot-site-novo/ Thank you.

.htaccess current.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
    
asked by anonymous 27.11.2015 / 12:34

2 answers

1

TL; DR

Remove any rule from your .htaccess that you will be able to access http://meudominio.com.br/hot-site-novo without problems.

Why does this happen?

Notice that your WP lives at the root of http://meudominio.com.br . In other words, if you access the files via your favorite FTP client, you will find the default files of the system, such as the wp-content folder, the wp-config.php file and so on. / p>

Note also that you are using writing rules (a.k.a. permalinks ). These rules are ways to create friendly URLs for pages, posts, and the like within WordPress even if that path does not exist physically.

This happens because the http://meudominio.com.br/hot-site-novo path is handled by the application and, within the scope of the application, the route does not exist.

How is this done?

Through .htaccess . It says that given a root access to the site (ie, http://meudominio.com.br/alguma-coisa ), that route will be handled by the application. You can change your permalink rules ( configurações > links permanentes ) to anything that does not the "Default", and .htaccess will always be the same.Take the test! What it does, basically, is to say that all page access goes through index.php (from WP) and, from there, and according to the rules you have set - the application will know what to show you.

With the permalink rules set, it does not matter how many other folders you put along with the default files of WP, or whatever you have inside them. ALL accesses will be routed to index.php of WP.

If you remove these rules, WP loses that control. This means that the hot-site-novo folder is now "visible" for direct access (again, take the test).

What now?

It's a classic trade-off situation. If you really want to make your hot-site-novo in hair, and host it together with WP (by the content of my answer you should already notice that I'm not very adept at this practice) having to sacrifice their writing rules and, with them, friendly URLs . This means that your WP will respond to things like http://meudominio.com.br/?page_id=39 . If, for example, you made a hardcode on your menu, and the links are static pointing to things like http://meudominio.com.br/minha-pagina , this ceases to exist (since the minha-pagina folder does not exist and never existed ), and BOOM! 404

I strongly recommend that you model your% of% within the WP logic. Doing something from scratch within that environment does not make the slightest sense. At some point, I've this answer in the gringo SO about the hierarchy of WP templates, and how to use it correctly. The content of the question is different, but the problem was basically the same. , also mine, but this time in SOpt, talks, too, about the same thing.

    
27.11.2015 / 14:22
1

This should only be a comment on Caio's answer, but I have no reputation for it. The only addition is that it is possible to change the .htaccess of wordpress so that it has no effect on the requests made to that folder. I believe altering to something like:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/hot-site-novo.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

start working.

    
25.02.2016 / 15:11