Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I set up Wordpress as a multisite and as part of the steps, it gave some instruction to update and replace the .htaccess file.

Wordpress instructed me to replace the htaccess with this:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

However this caused some jquery on a plugin to break.

I thought it might be useful, but could someone help provide some insight into what each of these lines does?

In particular this line:

RewriteRule ^(.*\.php)$ $1 [L]

As, if I remove this line, my plugin works fine.

Thanks in advance :)

share|improve this question
    
Is this a plugin that you wrote? A public one in the Repository? Or a premium one? –  brasofilo Feb 11 '13 at 19:25
add comment

1 Answer 1

RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
Redirects http://yourdomain.ext/wp-admin to http://yourdomain.ext/wp-admin/

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
Conditional logic, check if the requested filename is not a existing file (-f) or directory (-d).

RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
Redirect wp-content.ext, wp-admin.ext and wp-includes.ext to the file itself, whether this file exists or not.

RewriteRule ^(.*\.php)$ $1 [L]
Redirect any .php file to that file, whether the file exists or not.

RewriteRule . index.php [L]
Redirect everything to index.php.

Basically, the .htaccess redirects every requested file to that particular file, and every directory to index.php.

Read over the detailed mod_rewrite documentation for the details of how the rewrite engine works.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.