WordPress.org

Ready to get started?Download WordPress

Forums

Make index appear in other directories (13 posts)

  1. itissue
    Member
    Posted 6 years ago #

    Is there a way to make the index page show up in default when someone tries accessing say wp-content, or wp-includes through a browser? I've seen it done on other people's blogs and I'm curious as to how it's done. I know about the silence is golden index page that wordpress provides but it just makes a blank page appear.

    Any help is much appreciated.

  2. diabolus
    Member
    Posted 6 years ago #

    yup, you can configure it using htaccess or through your 404.php file

  3. itissue
    Member
    Posted 6 years ago #

    Could you tell me what I need to write? I have no clue.

  4. stanch
    Member
    Posted 6 years ago #

    put the following pithy codes into 404.php file of your wp theme:

    <?php
    
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: ".get_bloginfo('url'));
    
    exit();
    
    ?>

    if it doesn't work, please tell me, i'll give you another solution. thanks you :)

  5. itissue
    Member
    Posted 6 years ago #

    Sorry this didn't work. Thanks though.

  6. stanch
    Member
    Posted 6 years ago #

    didn't work? the errors?

    btw, you can try the example at my weblog by clicking http://aufklarung.org/wp-content/ ...

  7. itissue
    Member
    Posted 6 years ago #

    Well, wp-content still showed the files under that directory, but when I typed an invalid URL, the 404 page had an error:
    Warning: Cannot modify header information, so I reverted back to my original 404 page.

  8. stanch
    Member
    Posted 6 years ago #

    put Option -Indexes in the .htaccess file in your blog root dir.

  9. itissue
    Member
    Posted 6 years ago #

    Do you put it in like this?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    Option -Indexes
    # END WordPress

    or like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    Option -Indexes
    </IfModule>
    # END WordPress

    or something else entirely?

  10. itissue
    Member
    Posted 6 years ago #

    So I tried both ways, and I got an Internal Server Error for all pages in my web site.

  11. itissue
    Member
    Posted 6 years ago #

    I still have no luck with this issue. Can anyone help me?

  12. itissue
    Member
    Posted 6 years ago #

    Maybe I wasn't clear enough on what I am looking for. An example site of this in action would be http://little-wonder.net. Try typing the following extentions after the url to see the results:
    wp-config.php, wp-content, wp-admin. You can also try other extensions, even ones you know don't exist like asdf.

  13. itissue
    Member
    Posted 6 years ago #

    I came up with a solution, well sort of. What I did was created an index page that had this in it:

    <?php
    header( 'Location: http://suefeng.com' ) ;
    ?>

    and put that into the folders I don't want people to view such as wp-content, wp-content/themes, wp-content/plugins, etc. It doesn't use .htaccess or the 404 page, but it still works.

Topic Closed

This topic has been closed to new replies.

About this Topic