I am getting this bit of code inside a .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?pic=$1

Which does precisely what I would like it to do. Basically visit mydomain.com/345 it might be just like basically might have typed mydomain.com/index.php?pic=345, and print_r($_GET) returns this:

Array ( [pic] => 345 )

However, after i attempt to put this exact code during my precompiled conf-file, rather than b .htaccess file, it returns the entire internal road to the file rather, such as the $_GET parameter, as a result:

Array ( [pic] => var/www/mydomain.com/htdocs/345 )

Sure, I'm able to just fetch the final a part of that string or allow it to be use REQUEST_URI to obtain the data, but that would not be fixing the problem, just getting around it. Anybody knows why it's carrying this out? I am speculating it's related to the very fact it's producing the road internally?

Here's the entire conf file just in case you really need it, I only switched the domain title to help keep it somewhat neutral. :-)

<VirtualHost *:80>
    ServerAdmin info@mydomain.com
    ServerName mydomain.com

    # Indexes + Directory Root
    DirectoryIndex index.php
    DocumentRoot /var/www/mydomain.com/htdocs/

    # CGI Directory
    ScriptAlias /cgi-bin/ /var/www/mydomain.com/cgi-bin/
    <Location /cgi-bin>
            Options +ExecCGI

    # Logfiles
    ErrorLog /var/www/mydomain.com/logs/error.log
    CustomLog /var/www/mydomain.com/logs/access.log combined

    <Location />
           RewriteEngine On
           RewriteCond %{REQUEST_FILENAME} !-f
           RewriteCond %{REQUEST_FILENAME} !-d
           RewriteRule ^(.*)$ index.php?pic=$1


I "solved" it by changing:

<Location />

with this particular:

<Directory /var/www/mydomain.com/htdocs>

However, I am still curious why <Location /> did not work, anybody know?

The latest (apache 2.2) documentation of mod_rewrite has become clearly stating Location directives ought to be prevented (search Location within the page). You can observe some interesting mails on that the users httpd mailing list. But it was not mentioned for instance in the 2.0 documentation.

Although rewrite rules are syntactically allowed in and sections, this will not be necessary and it is unsupported.

Therefore it appears you had been on the mysterious unpredictable method of running mod-rewrite, that is certainly an unpleasant spot to live. Thanks for your question now I am aware :-)