Here is my folder directory
wordpress
project
html
index.html (html page)
wp-admin
wp-content
wp-includes
etc...
What I want if someone want to access the main directory folder i.e. project folder for example ( domain.com/project ) it redirect to wordress 404.php .htaccess
To ensure the server finds your 404 page, add the following line to your .htaccess file:
Deny from all
ErrorDocument 404 /page-404.html
Check the docs on Codex: Creating an Error 404 Page
Maybe help plugin:
http://wordpress.org/extend/plugins/private-files/
You need to create an .htaccess file in the directory you want to restrict. Then you will deny access to your directory and redirect redirect all "403 forbidden" request to a 404 page adding this lines to the .htaccess file:
Deny from all
ErrorDocument 403 /404
This are the only lines you need to include in this file.
Related
I have checked many wp sites recently and they allow to access the file from the include folder and they show error message on it
Path is
wp-includes/customize/class-wp-customize-background-position-control.php
Error message
Fatal error: Class 'WP_Customize_Control' not found in /home4/pcc/public_html/project/autosite/wp-includes/customize/class-wp-customize-background-position-control.php on line 1
Ideally it should not be accessible directly
I have used this in my htaccess but still same error
Options All -Indexes
Also they are crawling in google.
The de-index job will not work because it's a well-known file in all WordPress installation and Options -Indexes did not prevent users to access this.
Place a .htaccess file in wp-includes folder with below content. It's will return 403 status code when someone try to access .php file in wp-includes folder and its subfolders.
<Files *.php>
deny from all
</Files>
I have a site which is in wordpress, there is one folder within root of that, Which is built in static php.
When i am trying to protect that site with .htaccess it conflicts with root .htaccess of wordpress.
I have placed the protection htaccess within the folder
this is what i put in webmaster directory .htaccess file but it goes 404
ErrorDocument 401 /401.html
AuthType Basic
AuthName "welvo maker"
AuthUserFile "/home/welvo/.htpasswds/public_html/webmaster/passwd"
require valid-user
Hello you can protect subfolder directory using .htaccess by adding below line
RewriteBase /subfolderdirectoryname
As well as you can see reference link which will help you to understand better.
New rewrite rules in subdirectory with htaccess
My all wordpress pages suddenly start to show a 404 error which can be fixed by going to settings->permalinks and saving to re-create the htaccess files. However, within minuets the admin area is inaccessible giving a "too many redirects" issue. The only way to access the admin area is to delete the .htaccess file via ftp. This was not happening until I have set password protected directory.
In your main .htaccess file for WordPress add at the top the following code to fix the redirect loop error:
ErrorDocument 401 default
In your admin .htaccess file for WordPress add the following code to ensure that front end Ajax continues to work:
<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>
While accessing my WordPress website, I got directory listing error. I can access the site using http://example.com/index.php but not when I use http://example.com. I also tried put the .htaccess file in the directory. I had following code in my .htaccess file.
#BEGIN WordPress
#END WordPress
DirectoryIndex index.php
I solved it... If any want to change your site path not having access to control panel in your db go to the wp-options table change your site url link to http://www.example.com to the http://www.example.com/index.php
I have wordpress installed in the root of my website public_html
Although I have other folder inside a projects folder running their own websites.
The .htaccess in the wordpress folder (parent-most folder) might be causing issues for the inside folders.
Is there a way, I can mention for a folder not to look any higher for htaccess files ?
DETAIL:
The two main issues I am currently having our
- if I set the status code to 500, I am get redirected to my home page (index.php)
- if a page is not found, it gets redirected to index.php
Thanks.
Put this code in your .htaccess under DOCUMENT_ROOT directory (just above your wordpress rewrite stuff):
RewriteRule ^subfolder(/.*|)$ - [L]