Support » Fixing WordPress » Where to put .htaccess

  • Hey, I am new to this, but where do I put the .htaccess file?
    I was thinking in the wordpress folder, but I thought it might need to be in the root directory of the web server or something?
    Also, I think I might have a .htaccess file, as I needed one a while back. I dont think FileZilla shows it though! Would that be right, or have I deleted it and not realised?
    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Anonymous

    Thanks mate. I thought there would be an option to show hidden files, but I must have missed it.
    I will put one in the wordpress directory and see how it goes
    Thanks

    what is this file used for?
    please advise.
    Thanks

    It is used for creating good looking permalinks. Go to options-> permalinks and you’ll see it all 🙂

    @bruce
    Yes, you can add to the existing.
    Generally, you can also put a .htaccess in every directory as it is this small file that dictates – to a point – how access to that directory is governed.
    For instance, on my site, I have 3
    – one is at site root, and is where I put completely banned IP’s so they cannot access my site at all.
    – another is in a private directory so that someone needs a username and a password from me to access it
    – and the other is in my wordpress folder and like 2fargon says, this creates nice links for people to follow when encountered in search engines.

    I was wondering about this myself…. So it is okay to have multiple .htaccess files in different directories–this won’t screw up the site? So I can create a new one solely for use in my WordPress directory, and fill it with nothing but rules for permalinks?
    Would anyone be willing to show me an example of what should go into a WordPress directory .htaccess file, line by line? And would I be able to set the mod_rewrite thing in this WordPress-only .htaccess file?

    You can indeed have mulitple .htaccess files across a site, but only one in a directory.
    And here is my .htaccess file for my wp install:
    RewriteEngine On
    RewriteBase /T2/
    RewriteRule ^archives/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /T2/wp-feed.php?category_name=$1&feed=$2 [QSA]
    RewriteRule ^archives/category/?(.*) /T2/index.php?category_name=$1 [QSA]
    RewriteRule ^archives/author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /T2/wp-feed.php?author_name=$1&feed=$2 [QSA]
    RewriteRule ^archives/author/?(.*) /T2/index.php?author_name=$1 [QSA]
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /T2/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /T2/wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/trackback/?$ /T2/wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
    RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /T2/wp-feed.php?feed=$1 [QSA]
    RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /T2/wp-feed.php?feed=$1&withcomments=1 [QSA]
    RewriteRule ^stats/author/(.*)?/page/?(.*)?/?$ /T2/index.php?wp_stats=1&author=$1&page=$2 [QSA]
    RewriteRule ^stats/author/?(.*) /T2/index.php?wp_stats=1&author=$1 [QSA]
    RewriteRule ^stats/ /T2/index.php?wp_stats=1 [QSA]
    RewriteRule ^stats /T2/index.php?wp_stats=1 [QSA]
    RewriteRule ^recent-links/feed?/?$ wp-recent-links-rss2.php [QSA]
    RewriteRule ^recent-links?/?$ wp-recent-links.php [QSA]
    RewriteRule ^recent-links/([0-9]{4})?/?([0-9]{1,2})?/?$ wp-recent-links.php?y=$1&m=$2 [QSA]

    I have no idea *how* it works, but it does.
    The top lines concerning archives were generated by the permalinks part of wordpress.
    Everything following that is an addition for a plugin to correctly function.

    Ahhhh, this looks good! Thanks for the explanation, I’ll try this tonight.

    What should the permission on the .htaccess file be?

    644 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Where to put .htaccess’ is closed to new replies.