Re: Issue with URL Rewriting

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

 



Hi yvand,

Zitat von yvand <yvand.sword@xxxxxxxxx>:
Hi all,

I want to redirect all requests like /icon.png to /pictures/icon.png, if the file exists in the pictures folder.
It seems really trivial but I didn't manage to set up.

Here is my .htaccess :
    RewriteEngine On
    RewriteCond /pictures/%{REQUEST_FILENAME} -f
    RewriteRule ^(.+) /pictures/$1 [L]

If I request /pictures/icon.png it works, but if I request /icon.png I get a 404 error.

What is wrong with my .htaccess?

as you are in .htaccess (and not in global server/vhost context), I'd expect REQUEST_FILENAME to be the full path of the resource. From http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond :

"The full local filesystem path to the file or script matching the request, if this has already been determined by the server at the time REQUEST_FILENAME is referenced."

You may want to set up mod_rewrite logging (http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging) to verify this... the logging is generally *very* helpful in debugging such problems.

Regards,
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-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