Re: Checking if file or directory exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Pruim wrote:
RewriteRule . /p.php [L]
RewriteCond %{REQUEST_FILENAME} !-f

You're not capturing or passing anything, and how do you get to mail.php?

after you load purl.schreurprinting.com/jasonpruim112 there will be a link to http://purl.schreurprinting.com/mail.php?purl=jasonpruim112

The basic premise I have been working off of is just simply if the file exists, let that file handle serving the page, if it DOESN"T exist pass it to p.php to handle it.

So with that understanding I don't think that I need to capture anything in the rewritecond's other then if the file exists correct?
RewriteCond %{REQUEST_FILENAME} !-d

You shouldn't have to worry about capturing any query string since you are performing an internal rewrite (the URL stays the same for the user). Referring back to your other email (which I mistakenly nuked already)...

--------------------
That is odd.... I moved the rewrite rules to a .htaccess file and now the real links work right, but the false links don't go into my handeler script... in other words http://purl.schreurprinting.com/mail.php?purl=jasonpruim112 works but http://purl.schreurprinting.com/jasonpruim112 does NOT...

Here is my .htaccess file... Does it look right?

Options +FollowSymlinks
RewriteEngine on
RewriteLog /var/log/purl.virt.rewrite.log
RewriteLogLevel 9

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /p.php [L]
--------------------

So there is no file/directory called jasonpruim112 <http://purl.schreurprinting.com/jasonpruim112>, correct? I copied your .htaccess file (removing the RewriteLog* references) and it correctly rewrites the URL request for /jasonpruim112 <http://purl.schreurprinting.com/jasonpruim112> to p.php. Is this not what you are seeing?

Hey Justin,

You are correct that jasonpruim112 does not exist but is linked in a database... Although, I did some searching on the net and fighting with my config files and noticed that AllowOverides was set to none rather then all....

Once I made that switch both the main link, and the internal links all started working properly.

Sometimes I hate how picky computers can be hehehe.

Doh. I forgot to mention that moving to the .htaccess file would require apache to allow overrides in that directory. That was my default setting in my testing environment, so I didn't even think of it. If all else fails, I find checking the apache error log can sometimes reveal things that you may not have known were going wrong.

At any rate, it sounds like you're all set now!

--
Justin Pasher

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux