I’m trying to redirect all files from directory /cache/ to file /cache.php
This is the rule I’m using:
RewriteRule ^/cache/$ /cache.php
and it works perfectly on my localhost.
Problem is, for some reason it doesn’t work on live server. Is there something wrong with that rule or with server configuration? And if its server configuration, where can I fix it (its a virtual server with cpanel/whm, I have full access)?
Thanks for suggestion, but I don’t want a 301 redirect. In cache.php I check url to show different content, depending on what item from cache is being requested, so I need to keep original url.
The Redirect’s redirection MUST be an absolute redirection. If Apache is confused (physical path vs webspace path) then you can use an external absolute redirection, i.e., http://your.domain.com/cache.php.
If you don’t specify a 301, it’s supposed to make a 302 (temporary) redirect - at least mod_rewrite works that way. If you want to make a 302 redirect with mod_alias’s Redirect, specify it by replacing the 301 I used with 302.