freedom1972

trying to mimic a deep directory strucutre so I can redirct subdomain.myurl.com/a/b/c/d/e.html to subdomain.myurl.com?index.

php

 ?foo=a&bar=b etc...

I was doing some simple testing with

apache

 , but am running into this problem

RewriteEngine on

RewriteCond ^/(.*)/%{REQUEST_FILENAME} !-f
RewriteRule .* /index.

php

  <>

RewriteCond ^/%{REQUEST_FILENAME} !-d
RewriteRule .* ./index.

php

  <>

RewriteEngine Off


what I wanted to happen was this:

if I requested subdomain.myurl.com/foo/bar.html the first rule will fire, and if I requested subdomain.myurl.com/foo/ the second rule would fire. Instead I get

The requested URL /foo/bar.html was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

which to me looks like it is trying to use the error handling in the .htaccess file in the myurl.com as opposed to subdomain.myurl.com.

So:

1) is my mod_rewrite syntax correct?
2) do I need to "force" it to use my subdomain .htaccess for error handling over the parent

Bompa

/foo/bar.html does not actually exist, correct?  This is an example "fake" URL, right?

So, the request is not being matched by either of your directives.

If the syntax is not correct you will get  Internal Server Error.

wish i could say more, but breakfast is being served Applause

Bompa

btw,

REQUEST_FILENAME
    The full local filesystem path to the file or script matching the request.


you sure that's what you want?

i usually use REQUEST_URI

Bompa

yah, ummm...

this works for me


RewriteCond %{REQUEST_URI} (/.*/?)
RewriteRule (.*) homepage.cgi <>


Then I have my

perl

  script do: 
print "REQUEST_URI: $ENV{REQUEST_URI}<br>";



clinically tested.

Applause

freedom1972

thanks - I will try the above and see if that gets me what I am going after.


Perkiset's Place Home   Politics @ Perkiset's