I am using WordPress, I have to hide WP-includes, and WP-content/uploads from WordPress. I have tried to add the below code in htaccess
Options -Indexes
Also, I have referred to this link but still, it's not working for me.
The below link is working
http://localhost:8080/wordpress/wp-includes/
but if I add then I can see all the files. Same for the upload folder
http://localhost:8080/wordpress/wp-includes/assets
http://localhost:8080/wordpress/wp-content/uploads/2022/01
Note-localhost is just an example
Where does the .htaccess file exist on the server? Which path?
Are you sure your web server is processing this file? Are you indeed running Apache?
As long as you have a file named .htaccess (no spaces), and it's placed in your root HTML folder, or within both wp-includes and wp-content folders, and somewhere within the file on its own line, you have Options -indexes, this should be respected for all subfolders and turn off auto-indexing. Can you share the entire contents of this file, perhaps you have placed this line somewhere it's not being read.
After some research, I have created a .htaccess file in the wp-content/uploads and added the below code. And it's started working
# Kill PHP Execution
<Files ~ ".ph(?:p[345]?|t|tml)$">
deny from all
</Files>
Related
I have a wordress site but I have a simple page which is not part of the wordpress project
http://sitetest.com/mypage.php
How can I make wordpress ignore this file and allow it to be shown
Just upload this php file to your /public_html directory and run as usually http://sitetest.com/mypage.php, it should work.
UPD. I checked and it works for me.
Just put the file in the site root folder. It will be accessible.
Example: if your site root is /var/www/html/ or public_html then put the file in html/public_html folder where others WordPress files & folders are like wp-content, wp-includes, wp-admin etc.
I am making my first steps coding and I have wordpress installed on my computer on a local XAMPP server. I try to add an image directly in a page from the wp admin but it's not possible and it shows me this error :
Unable to create directory wp-content/uploads/2016/03. Is its parent directory writable by the server?
Do you know why it happens? I create manually the directory wp-content/uploads/2016/03 and its still happening.
Create folder with name "uploads" in wp-content folder and set this folder permission 777
Hope it will work
Thanks
Try to manually update/change the uploads directory instead of defaults:
Log into your WordPress admin dashboard.
Go to Media Settings menu (Settings -> Media).
Enter wp-content/uploads in the “Store uploads in this folder” text
box.
Save the changes by hitting the “Save Changes” button and you are
done.
Note: if you don't have this option in your wordpress version, you need to edit the wp-config.php file located in the root directory of your WordPress installation.
define( 'UPLOADS', 'wp-content/'.'uploads' );
also you can change the name of uploads folder as you want.
UPDATE 1:
Try adding the following to the top of your .htaccess file (before # BEGIN WordPress line):
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
When I go to Options->Permalinks and update my permalinks, ".htaccess" did not appear. I tried to put a blank .htaccess file manually. Then go to Options->Permalinks and update again my permalinks. But the .htaccess file is still empty.
The PHP process must be able to write your file, so you have to check the file permissions. You can do this using your FTP tool or on the command line (chmod command), if you are on UNIX.
File permission for .htaccess files is usually set to 644.
I'm a newbie here. I installed a wordpress in a server run by Apache2. But the wordpress doesn't load index.php page. I can access deshboard and all other categories are displaying well. but the home url is not loading the index.php. Eventhough i try to added /index.php at the end of my url, still it's not working. It just display 404 error. When i look at the theme directory and wordpress directory, there are (index.php) files.
so I googled for solution. some suggested to add
directoryindex index.php in .htaccess file. I did that and that result in 500 internal server error.
Some post in google suggest to look at dir.conf and httpd.conf under Apache2. In my httpd.conf file, I have this line of code
SSLcertificateChainfile /etc/ssl/certs/secure_yosalasd_org.ca-bundle
In my dir.conf file, I have this lines of code
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
I don't seem to find answer to this problem.I would appreciate if anyone can figure out what is the problem here.
thank you so much in advance
regards
Khun
This may be a long shot, but once saw a simillar problem which in the end the problem was that there was an index.html file as well in the folder.
Make sure such file does not exist.
And did you try re-installing?
may be the premits of htaccess disallow it from working, that will result not found pages
if you uploaded the script though root access
try this command
chown -hR user:user folder_path;chmod -R 644 folder_path/*.php
replace user by your user name, replace folder path by the full path of wordpress
Edit:
The problem is your theme not include index.php
try to explore your theme directory, and check if there is index.php file, or switch to another theme
if the file is exists, Try to change file permissions use the command that i provided above again, i've edited it
You can change main diretory and sub directory all php files permission with this SSH Command
find /top/level/directory -type f -name "*.php" -print | xargs chmod 644
So I have been reading all i can for the last 2 hours and have not a solution.
I moved my drupal site from one host to another, all works well minus:
images in the the 'sites/defualt/files' folder are in the FTP and i can priview them there but when got to the URL I just a page not found message.
example image URL: http://www.example.com/sites/default/files/image.jpg
this what's in my code and the path is correct but the image does not show.
Here's what I have checked:
Clean url's are enabled,
'admin/settings/file-system', set to public
'admin/settings/file-system', File system path: 'sites/default/files' as it should be
.htaccess in files folder is set to
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
# Options None
# Options +FollowSymLinks
and I have tried it with '#' removed
I have tried leaving the settings.php $base_url ="" blank and with my exsample domain
I have the files folder set to cmod '777'
Checked the database files table, path is set to 'sites/default/files/imagename.png', which seems right
image names do not have spaces in them.
I have been flushing the cache for the testing different settings
I have run the cron as well.
I don't know what I am missing the files are there, the paths are even correct when i look at the rendered html, but the images are just not showing and the direct urls say 'page not found'
Any Help would be awesome, I thought i had this problem before and solved it but i have no idea I missed.
Thanks for any help
Hhmm, have you checked that all parent folders have at least the execute flag set so that you can browse into them? I think it is safe to set all folders as: 755
Another way to debug this is trying to download other files contained in other folders, e.g. the README in root or some files in the misc/ and modules/ folders.
Just deleted .htaccess file inside default/files it solved the issue for me..I dont exact lines of code need to be there in .htacces file..