Support » Fixing WordPress » .htaccess file

  • I’m trying to get permalinks to work, but I’m not at all familiar with the .htaccess/mod_rewrite. When I downloaded WordPress, example.htaccess was included. Is that file supposed to be renamed to something in particular? Also, in the Options section of the WordPress panel, it says “For this to work you’ll need mod_rewrite installed on your server “…what’s that?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Mod_rewrite is a module for the Apache web server tha, among other things, allows for things like rewriting long, cumbersome, Google unfriendly URLS like into something like
    Basically, to use the code generated in the permalinks option page, copy it, and open up your text editor. Paste it in a new document, then save the document as ‘.htaccess’. This needs to go in your root WP directory (the directory that contains all your WP files and folders.) Simple as that, assuming your server has mod_rewrite installed.
    If it works, then it does. If it doesn’t, there could be other problems, but the first thing to check is your hosting company, to see if they do in fact have it installed.

    Is the .htaccess file supposed to “disappear” from the FTP after you rename it (from example.htaccess to .htaccess)? Does it matter that I’m using a subdomain?

    Yes, the file will not show up on your FTP client. You would have to work directly on your web server to see it show up.

    Often there is a setting in the FTP client to hide/show the ‘.ht…’ files.

    AceFTP does not show it, while SmartFTP shows it!
    These are the 2 software I use for my FTP requirement…

    I highly recommend FileZilla on windows.

    Thanks everyone. How do the permalinks work, though? The permalinks work now, but the actual files aren’t in the ftp, yet they “magically appear” (for lack of a better term). I don’t think they’re hidden, either, because the entire archive folder (for me, it’s /past) is nonexistent.

    @asphodel: The way it works is this – when you put those lines into the .htaccess file, it tells Apache (the web server software) to look for any requests for (or whatever you decided on for your format) and to re-interpret them to ACTUALLY load the page (or whatever the actual formatting is, I’m just paraphrasing here).
    The mod_rewrite library is quite a powerful tool… if you ever do something like change your archive formatting (something I have done several times in the past) or change your content management system, you can just add in a re-write rule and all of your old links (if you’ve been indexed by google, as an example) will still work.

    Quick question about the .htaccess file — was there not an example.htaccess included in past versions of WP? The nightly build doesn’t have this, nor does the Platinum release. Or am I just imagining things?

    I don’t recall seeing one… but then I’ve got my own .htaccess already so maybe I deleted it and just blocked my memory of doing so 😛

    No, there was an example.htaccess, but if I recall correctly, it contained other rules besides rewriting the urls. Ah..found it..take a look if you’re curious about what it contained. (From a copy of the 12.24.03 CVS):
    # this will make register globals off in b2’s directory
    # just put a ‘#’ sign before these three lines if you don’t want that
    <IfModule mod_php4.c>
    php_flag register_globals off
    # this will set the error_reporting level to remove ‘Notices’
    <IfModule mod_php4.c>
    php_value error_reporting 247
    # This activates content negotiation, so instead of /archives.php you could just call
    # a file as /archives . Same for any other file on your site. Try it out!
    Options +Multiviews

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