PDA

View Full Version : mod_rewrite Bafflement


noleli2
2008-03-09, 12:02
I recently installed Wordpress to my Dreamhost account, and I'm using Permalinks that use mod_rewrite in a .htaccess file to make them pretty. I'm also keeping the installation in a Subversion repository.

Subversion on Dreamhost is done through an http request to http://mydomain.com/svn/repo/, but the .htaccess file contains
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I believe that this means that if the requested file is neither an actual file nor directory in the base directory, it will get sent to index.php. I also want to exclude requests that start with /svn/, so I tried adding the line
RewriteCond %{REQUEST_URI} !^/svn/.*$, the idea being that the RewriteRule would not apply to /svn/ requests.

This didn't work, but I found in the Dreamhost wiki (http://wiki.dreamhost.com/Mod_rewrite#Problem_with_.2Fstats) an explanation of how to make other "special" pages that they run (/stats, etc.). They said to add
RewriteCond %{REQUEST_URI} ^/(stats/|missing\.html|failed_auth\.html) [NC]
RewriteRule . - [L]
above the WordPress stuff, which made sense. I changed ^/(stats/|missing\.html|failed_auth\.html) to ^/svn/.*, but that did not work.

However, when I left their condition as is, /svn/worked as expected!

Does anyone have any ideas why that might be the case? That /svn/ requests work fine when the condition is for /stats/ and those other files, but not whet it's actually for /svn/?

I'm pleased that I have it working, but baffled that it works.

noleli2
2008-03-18, 07:07
Nobody?

Gargoyle
2008-03-22, 17:42
I use these when I am making zend framework apps...

RewriteEngine On
RewriteCond %{REQUEST_URI} !/scripts.*
RewriteCond %{REQUEST_URI} !/images.*
RewriteCond %{REQUEST_URI} !/styles.*
RewriteRule .* index.php

php_flag magic_quotes_gpc off
php_flag register_globals off