What is this .htaccess file doing??? I don’t know anything about .htaccess .please help.
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
This turns on the rewrite engine, all the rules get ignored if this isn’t in the htaccess file
This tells the rewrite engine that relative URL-paths should use this as its base
This rule means: “If the request is
index.php
, then pass it through the rewrite engine and stop rewriting”This rule matches against
<some stuff>
thenwp-admin
, and redirects the browser to the same URL except it ends with a slash. Example:http://example.com/foo/bar/wp-admin
gets redirected tohttp://example.com/foo/bar/wp-admin/
This rule says if the request is for a file or directory that exists, pass it through the rewrite engine and stop rewriting.
This rule matches against
<some stuff>
thenwp-content
orwp-admin
orwp-includes
, and rewrites the URI to everything after the<some stuff
> Example:http://example.com/blah/blah/wp-admin/some/more
gets rewritten to/wp-admin/some/more
.This rule matches against
<some stuff>
followed by any php file, and rewrites the URI to everything after the<some stuff>
. Example:http://example.com/abc/123/somefile.php
gets rewritten to/somefile.php
.Finally, if none of the other rules got applied, this rule rewrite everything else to
/index.php
.