Moderator
James Huff
(@macmanx)
Volunteer Moderator
Yes, that’s default behavior. No, it doesn’t matter. No, it’s not dangerous. If you really want to close off the directory, there are two things you can do.
One is to create an index.php file with only the following code in it (all on one line):
<?php header('Location: http://www.yourdomain.com/blog/index.php'); ?>
This, if placed in the /wp-content/
directory, will redirect all attempted visits back to your blog (or a page of your choosing).
Two is to create a .htaccess file with the following line in it:
IndexIgnore *
This, if placed in the /wp-content/
directory, will issue a 403 Access Denied error to all attempted visits.
To make your text bold, surround it with <strong>
</strong>
tags. To make your text italic, surround it with <em>
</em>
tags.
thanks, macmanx, your information is very informative.
but still can’t understand the .htaaccess file
how do i create it? and mind to tell me a bit clearer? thanks a lot again.
Moderator
James Huff
(@macmanx)
Volunteer Moderator
Well, first you’ll need a text editor. See: http://codex.wordpress.org/Glossary#Text_editor
Now, open your chosen text editor and create a new document with only the following line at the top:
IndexIgnore *
Now, save this file as “htaccess” and upload it to your /wp-content/
directory. Once it’s uploaded, add a dot in front of the filename. The resulting filename should be “.htaccess” (without the quotes, of course). And, that’s all that needs to be done.
that means i’ve to, beside this htaccess file
need to create another index.php file
with the following line inside it
<?php header(‘Location: http://www.yourdomain.com/blog/index.php’); ?>
and place it in my wp-content directory? is it?
If your host uses cPanel, you may also be able to do this from there. Look for the “index manager will allow you to turn indexes on or off for a directory. If indexes are off, people will not be able to see what files are in a directory that lacks an index file.”
Moderator
James Huff
(@macmanx)
Volunteer Moderator
Does that mean that I have to, besides this htaccess file, create another index.php file and place it in my wp-content directory?
No, sorry for not making that clear. One option is to create the index.php file. Another option is to create the .htaccess file.
If you use Apache, just remove the “Indexes” from “Options Indexes FollowSymLinks” of your root directory of httpd.conf. Which is default.
You can try my blog at http://ying.homedns.org/wp/
But it is encoded in Chinese, you probably cant read it.
The very easiest is this:
Open Notepad
Type “Go away”
Save as “index.html”
Upload that to any and every directory that does not have an index file in it. This could be image directories too.
That WILL work
.htaccess is cool, but this is simple, fast and failsafe.
stchatterbox: if you want them to be redirected use the index.php method. If you want them to get a 403 error, use the .htaccess
ok, got it…thanks, and i should only write
<?php header(‘Location: http://www.yourdomain.com/blog/index.php’); ?>
in the index.php file, right?
Moderator
James Huff
(@macmanx)
Volunteer Moderator
If you want to do the index.php method, first you’ll need a text editor. See: http://codex.wordpress.org/Glossary#Text_editor
Now, open your chosen text editor and create a new document with only the following line (all on one line) at the top:
<?php header('Location: http://www.yourdomain.com/blog/index.php'); ?>
Replace http://www.yourdomain.com/blog/index.php
with the URL that you want the visitor to be redirected to.
Now, save this file as “index.php” (without the quotes, of course) and upload it to your /wp-content/ directory. And, that’s all that needs to be done.