Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Default WordPress .htaccess File
#1
Lightbulb 
PHP Code:
.htaccess

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

# END WordPress 

here is the default .htaccess file for WordPress is used to manage permalink settings and URL redirection. Here’s the standard version:

Explanation
  • RewriteEngine On: Activates the rewrite engine.
  • RewriteBase /: Sets the base URL for the rewrite rules.
  • RewriteRule ^index.php$ - [L]: Prevents direct access to index.php.
  • RewriteCond %{REQUEST_FILENAME} !-f: Skips rules if the file exists.
  • RewriteCond %{REQUEST_FILENAME} !-d: Skips rules if the directory exists.
  • RewriteRule . /index.php [L]: Redirects all requests to index.php to be handled by WordPress.

Usage
Place this .htaccess file in the root directory of your WordPress installation.
Ensure the file has appropriate permissions (typically 644).
This file will automatically update when you change WordPress permalink settings. Avoid manual edits unless necessary for custom rules or security enhancements.
  


Bookmarks

Forum Jump:


Users browsing this thread:
4 Guest(s)