Title: mod_rewrite for wordpress.
Last modified: August 19, 2016

---

# mod_rewrite for wordpress.

 *  [hawthorn](https://wordpress.org/support/users/hawthorn/)
 * (@hawthorn)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/)
 * Can anyone please explain in simple terms exactly what this wp mod_rewrite code
   is doing..
 * <IfModule mod_rewrite.c>
    RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME}!-
   f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule
   >

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [wagonlips](https://wordpress.org/support/users/wagonlips/)
 * (@wagonlips)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/#post-757472)
 * I don’t know about simple terms, but here’s the doc page from apache: [http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html](http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html)
   and here’s a little more info also from apache: [http://httpd.apache.org/docs/1.3/misc/rewriteguide.html](http://httpd.apache.org/docs/1.3/misc/rewriteguide.html)
 * My interpretation of that code is:
    RewriteEngine On # Wake up the rewriting 
   elves! RewriteBase / # Start with the server root. RewriteCond %{REQUEST_FILENAME}!-
   f # If the request is for a real directory (one that exists # on the server),
   index.php isn’t served. RewriteCond %{REQUEST_FILENAME} !-d # If the request 
   is for a file that exists already on # the server, index.php isn’t served. RewriteRule./
   index.php [L] # This is the rule that corresponds to the above two # conditions.
   I think it will put /index.php on the # end of any request that does not match
   the conditions. # I think.
 * Actually, the answers for the %{REQUEST_FILENAME} bits I copied from this thread
   over here:
    [http://forum.mamboserver.com/archive/index.php/t-42366.html](http://forum.mamboserver.com/archive/index.php/t-42366.html)
 * This is pretty confusing stuff. Here’s a little more info in regards to permalinks:
   [http://codex.wordpress.org/Using_Permalinks](http://codex.wordpress.org/Using_Permalinks)
   but I’m still trying to research some weird behavior with this exact set of rules,
   but using the litespeed server software.
 * Like a dinghy afloat on the sea of life.
 *  [wagonlips](https://wordpress.org/support/users/wagonlips/)
 * (@wagonlips)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/#post-757481)
 * The problem I’m having is that while this set of rules works like a charm under
   Apache, it behaves a little too free and easy under Litespeed. Meaning:
 * <IfModule mod_rewrite.c>
    RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME}!-
   f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule
   >
 * …will rewrite absolutely any string at all as a directory and then slap index.
   php on the end of it. The actual 404 never gets served.
 * Very puzzling.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 8 months ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/#post-757482)
 * WordPress handles 404 errors internally. That’s what the 404.php is for in the
   theme.
 * And those rules essentially say to redirect any hit for a file that does not 
   actually exist to WordPress’s main entry point (the root index.php file). Because
   WordPress will parse the URL and figure out where to go from there.
 *  [wagonlips](https://wordpress.org/support/users/wagonlips/)
 * (@wagonlips)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/#post-757483)
 * Thanks Otto. Do you have any idea why, when using Litespeed, WordPress parses
   the URL and fails to figure out where to go? (Whereas the same setup on Apache
   just works.) Do you think the rewrite rules are actually *not* the problem? And
   if not, then what?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 8 months ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/#post-757484)
 * Err.. No. With Litespeed it should just work, no issues. If WordPress loads on
   a pretty permalink, then it’s working.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘mod_rewrite for wordpress.’ is closed to new replies.

## Tags

 * [mod_rewrite](https://wordpress.org/support/topic-tag/mod_rewrite/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [17 years, 8 months ago](https://wordpress.org/support/topic/mod_rewrite-for-wordpress/#post-757484)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
