Index in Wordpress Subfolder

Asked

Viewed 943 times

0

I’m riding a hotsite on php in subdirectory where the installed WordPress. But by accessing the folder you’re giving me the error 404, being with a index.php normally. I searched and could not locate how to solve the problem. 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>
  • settings > permanent links "select Post Name option and click save" see if it resolves..

  • @Pablocampina is already in this setting. Thank you!

  • please give more details of your configuration so that we can understand why the problem is occurring.

  • @Pablocampina I am with all normal settings. I put the .htaccess current Wordpress. What information can help?

  • let me take a look at your wp-config.php and see the URL that is configured in the table wp_options column option_name option siteurl

  • @Pablocampina is configured my test domain location. $table_prefix = 'wp_';&#xA;&#xA;define('WPLANG', 'pt_BR');&#xA;&#xA;define('WP_DEBUG', false);&#xA;&#xA;if ( !defined('ABSPATH') )&#xA; define('ABSPATH', dirname(__FILE__) . '/');&#xA; &#xA;require_once(ABSPATH . 'wp-settings.php'); Do you want access to the bank? To check the tables?

  • To my view it’s all ok then, you another wp running on the same server and it’s ok?

  • @Pablocampina Wordpress is working normal, but it is not letting access to the subfolder that created a new index.php files when accessing is giving the 404. Somehow Wordpress is holding access to this index. Being that it is a normal and simple file.

  • @Moisesgama he will not let even. See the answer

  • @Moisesgama your problem has been solved?

Show 5 more comments

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 hassle-free.

Why does this happen?

Realize 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 files default system, such as the folder wp-content, the file wp-config.php and so on.

Also note that you are using writing rules (a.k.a. permalinks). These rules are ways to create Urls friendly to pages, posts and the like within Wordpress even if this path does not physically exist.

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

How is it done?

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

With the rules of permalink defined, no matter how many other folders you put together with the files default WP, and whatever’s inside them. ALL the accesses will be routed to the index.php of the WP.

Should you remove these rules, WP loses this control. It means the folder hot-site-novo is now "visible" for direct access (again, test).

And now?

It’s a classic situation of trade-off. If you really wants to do his hot-site-novo at the fur, and host it along with the WP (by the content of my answer you should already note that I am not very adept at this practice), you will have to sacrifice your writing rules and, with them, the Urls friendly. 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, that ceases to exist (since the folder minha-pagina does not exist and never existed), and BOOM! 404

I strongly recommend that you model yours hot-site-novo within the logic of WP. Doing something from scratch within that environment doesn’t make any sense. At some point, I gave this answer in the gringo OS 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. That other answer, also mine, but this time in Sopt, talks about the same thing.

1

This should be just a comment in Caio’s reply, but I have no reputation for it. The only addition is that it is possible to change the . htaccess wordpress so that it has no effect on requests made to that folder. I believe by changing 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-up.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.