0

I have a .htaccess file that looks like this. What i would like to do is pass the request onto index.php if the file or directory exists and a 403 error was generated as well.

that is, if "/foo/bar" exists on the server, but a 403 is generated i want that "/foo/bar" passed onto index.php as if the directory "/foo/bar" doesn't exist on the server.

possible?

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  #Make sure the physical file doesn't exist
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteRule . /index.php [L]
</IfModule>

1 Answer 1

2

Handling of error conditions is performed via ErrorDocument.

3
  • is it possible to pass all the query and url information to ErrorDocument like with mod-rewrite? Doesn't seem in the docs.
    – mbond
    Commented Jun 1, 2012 at 11:55
  • I'm... going to assume that you didn't actually read them... Commented Jun 1, 2012 at 11:58
  • simply adding "ErrorDocument 403 /index.php" handles this case.
    – mbond
    Commented Jun 1, 2012 at 14:37

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