Sergio,
The -f will match a file which exists just as -d will match a directory which exists. The !-f and !-d negate these, i.e., if the request is neither a file nor directory, then ...
Other problems:
1. [rant #4]The definition of an idiot is someone who repeatedly does the same thing expecting a different result. Asking Apache to confirm the existence of ANY module with an <IfModule> ... </IfModule> wrapper is the same thing in the webmaster world. DON'T BE AN IDIOT! If you don't know whether a module is enabled, run the test ONCE then REMOVE the wrapper as it is EXTREMELY wasteful of Apache's resources (and should NEVER be allowed on a shared server).
[/rant 4]
OMG! Not only do you make this test once but TWICE!
2. What does "catched" (cached) have to do with mod_rewrite code?
3. Other coding problems:
Code:
<IfModule mod_rewrite.c>
# Where did this get closed?
RewriteEngine On
RewriteBase /
# strip blog from URI
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)\.html http://%{SERVER_NAME}/$1 [R=301,L]
#
# This code will never be matched/redirected as the above block will have removed blog/
RewriteCond %{HTTP_HOST} =!blog/page/.*
RewriteCond %{HTTP_HOST} =!blog/tag/.*
RewriteCond %{HTTP_HOST} =!blog/category/.*
RewriteRule ^blog/(.*) http://%{SERVER_NAME}/$1 [R=301,L]
# remaining.html files
# Strip .html extension from non-file requests
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$ /$1 [R=301,L]************
#
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# doesn't index.php exist? !-f will be sufficient
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? /index.php [L]
# Handle empty request, too!
</IfModule>
# END WordPress
[/QUOTE]
From your use of "canned" code without understanding even the basics, I need to recommend the tutorial linked in my signature. It's helped others and should help your understanding. The sample code explanations should also help.
Regards,
DK
Bookmarks