rewrite rule custom.php to custom.css

António P. P. Almeida appa at perusio.net
Sat Jan 7 22:47:09 UTC 2012


On 7 Jan 2012 14h00 WET, nginx-forum at nginx.us wrote:

> If you want it mod_rewrite style (so no 302 Temporary Redirect
> header):
>
> location ^/wp-content/themes/mytheme/assets/css/ {
> rewrite custom.css custom.php;
> }

Why this? Nginx is not Apache. There's no need for rewrites, in fact
in most mod_rewrite -> nginx conversions you won't need them at all,
IMO.

If you want to return a 301 then just replace the 302 by 301.

Furthermore the '^/' doesn't function since there's no ~ or ~* to denote
a regex based location.

--- appa



More information about the nginx mailing list