Miscellaneouss

WordPress htaccess Rules For A Directory

WordPress-htaccess-rules-700x430
mm
Written by Santosh Prasad

In this article I will cover just about WordPress .htaccess rules for a directory. The main purpose of this rule set is to allow arbitrary paths (permalinks) be sent to the proper WordPress script without causing file/path not found 404 errors. If you see your permalinks is working but there are no .htaccess file on document root, it is because it is hidden. In Linux OS all filename beginning with a dot (.) treats as a hidden file. You can enable FTP client to enable viewing of all hidden files.

If WordPress Is Installed In the Site’s Root Directory

If your WordPress is installed in the site’s root directory, It creates and uses the following htaccess directives:

# BEGIN WordPress

 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]

# END WordPress

If WordPress Is Installed In the Some Subdirectory

If your WordPress is installed in some subdirectory such “site”, It creates and uses the following htaccess directives:

# BEGIN WordPress

 RewriteEngine On
 RewriteBase /site/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /site/index.php [L]

# END WordPress

Thanks:)

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment