views:

11

answers:

2

Hi,

I agreed to host a file for an online community, but I've since changed my site around so that it's now hosting a wordpress blog. What I'd like is to not break the existing URL to this one file, so, for example, when people navigate to the URL where file is being hosted, e.g. myblog.com/path/to/file, I'd like Apache to handle the URL rather than Wordpress, so that the file on the filesystem is delivered, rather than a Wordpress "We could not find the post" page. I think that the way to do this is to modify .htaccess so that that specific URL myblog.com/path/to/file does not execute index.php. Right now, here's what my .htaccess file looks like:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Could anyone tell me how to modify .htaccess to unmanage the URL to one file, but execute index.php for all other URLs?

Any guidance would be appreciated. Thanks.

+1  A: 
Redirect permanent /old/path/to/file /new/path/to/file
# BEGIN WordPress ...
toscho
+1  A: 

These rules

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

will tell mod_rewrite to skip any file or directory which actually exist. As long as you don't move this special file of yours, then mod_rewrite won't redirect the rewrite to the main index.php.

Now, if you're moving the file elsewhere, but want to preserve the old url, then you'll have to do as toscho said in his answer do a Redirect.

Marc B