WordPress.org

Support

Support » How-To and Troubleshooting » What should .htaccess look like?

What should .htaccess look like?

  • What needs to be in the .htaccess file in the root directory?

    I recently removed Gallery2 and the wp-gallery2 plugin, and think they have left a lot of clutter:

    # BEGIN Url Rewrite section
    # (Automatically generated. Do not edit this section)
    <IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_FILENAME} !/wp-gallery2\.php$
    RewriteRule . – [L]

    RewriteCond %{THE_REQUEST} \ /d/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !/wp-gallery2\.php$
    RewriteRule . /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L]

    RewriteCond %{THE_REQUEST} \ /v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !/wp-gallery2\.php$
    RewriteRule . /wp-gallery2.php?g2_view=core.ShowItem&g2_path=%1 [QSA,L]

    </IfModule>

    # END Url Rewrite section

    How much of that can I get rid of?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Here is a VERY BASIC .htaccess

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

    Let us know if this helped!

    Maybe… what does that do?

    All it does is check to see if you have mod_rewrite installed, if so it is applied to the way Apache operates, if not, it does nothing.

    It gets kind of detailed, so it would be better if you searched for mod_rewrite/Apache to get a proper description.

    mod_rewrite

    mod_rewrite is an extension module of the Apache web server software which allows for “rewriting” of URLs on-the-fly. Rewrite rules use regular expressions to parse the requested URL from the client, and translate it into a different URL before interpretation.

    WordPress uses mod_rewrite for its permalink structure, which is optional functionality.

    Related articles: Using Permalinks

    It is a default .htaccess found in many WP sites.

    So is that something I should see if I enable permalinks in WordPress?

    Will it be generated automatically, or do I have to create it myself?

    Hmmm. That does not seem to be working.

    When I choose “pretty” Permalinks in wp-admin, it says it’s made the changes successfully. However, going to my site and clicking on post titles returns an error: “No input file specified. “

    I notice that the .htaccess file is unchanged. Write permissions to the file are enabled, and I do not get an error message in WP when saving changes to the permalink structure.

    In any case, I’ve since manually created a .htaccess file that prevents access to wp-config, that seems to work fine.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘What should .htaccess look like?’ is closed to new replies.
Skip to toolbar