How to access folder that is in root (WordPress) - wordpress

I have created a folder in the root of my server. While trying to access it from a URL it gives a 404 error.
How can I create a .htaccess to access this folder and file inside the folder?

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

Related

Non Wordpress file/ folder in public_html not working

I have installed WordPress in the root directory. There is a folder "order" and "admin3" in the same directory. I can not open this folder www.mysite.com/order with this URL or any file inside of it www.mysite.com/order/login.php. When I open this file I get " is currently unable to handle this request.
HTTP ERROR 500".
I have tried this on the .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/order/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
# 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

Create custom folder in wordpress installation

Hi i have a wordpress site and i want to create a custom folder in the root directory which will be independant from the wordpress. What rewrite rule i have to use in order to access that folder?
I have put
RewriteRule ^clients? /clients/index.php [L]
Current htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^clients? /clients/index.php [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
When i access that folder i get an internal server error 500
You must have an infinite rewrite loop, see this answer. Try this:
...
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^clients? /clients/index.php [L]
...
For perfection, you might want to add the QSA and NCflags as well.

Want to stop subdirectory from showing in urls

I've read a lot of threads on this topic, but I'm not very proficient at this stuff and nothing has worked for me.
I installed Wordpress in a sub directory and:
Changed the site address URL to the main domain in WordPress.
Then I copied the .htaccess and index.php to the root directory.
Then I changed the index.php file so that the require(‘wp/wp-blog-header.php’) pointed to the subdirectory.
Everything works, except the subdirectory shows in the URL, which I would like to hide.
The subdirectory I installed to is 'NA20H'. After changing the index.php file to point to it, this is what I have.
The .htaccess file in the Root directory reads:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /NA20H/index.php [L]
</IfModule>
And the .htaccess in the subdirectory reads:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /NA20H/index.php [L]
</IfModule>
What do I need to do in order to get 'NA20H' to stop showing in the URLs?
Thank you.
No need to copy index.php to root. Just follow these steps.
Put this in the .htaccess in the root.
RewriteEngine On
RewriteBase /
RewriteRule ^$ NA20H/ [L]
RewriteRule ^(.*)$ NA20H/$1 [L]
Put this in .htaccess in the NA20H folder
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

Accessing Another Directory with Wordpress Installed

I have Wordpress installed on a shared host at Site5. It's installed in the root directory:
www.domain.com
I have another directory that I want to be able to access outside of the Wordpress site:
www.domain.com/directory/
When I visit this URL, I get Wordpress's 404-page. The .htaccess file, as modified by WP, reads:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I assume I need an edit to the .htaccess file to access this directory?
Edit .htaccess present inside "directory"
It should be:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /directory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /directory/index.php [L]
</IfModule>

issues with Mod Rewrite with folders inside wordpress page

I'm working on a client app and im using the Slim framework.
the root of the site is a wordpress page
and my app stuff is under
http://example.com/yumninja_app_1_0/api/
when you go to the url, it returns a 404, but the 404 is from the wordpress page.
the htaccess file on the root is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
and the htaccess inside my folder (yumninja_app_1_0/api/) is
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
My question is how to exclude a folder from mod_rewrite?
Add this line before RewriteRule
RewriteCond %{REQUEST_URI} !^/(yumninja_app_1_0|yumninja_app_1_0/.*)$

Resources