hi,
how can i rename custom.php to custom.css for my wordpress custom css.
let say i put my custom.php inside my theme folder
http://example.com/wp-content/themes/mytheme/assets/css/custom.php
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220792,220792#msg-220792
od3n
#2
On 4 Jan 2012 14h12 WET, [email protected] wrote:
hi,
how can i rename custom.php to custom.css for my wordpress custom
css.
You mean rewrite or redirect I suppose.
let say i put my custom.php inside my theme folder
http://example.com/wp-content/themes/mytheme/assets/css/custom.php
Try:
location ^~ /wp-content/themes/mytheme/assets/css/custom.php {
return 302 /wp-content/themes/mytheme/assets/css/custom.css;
}
— appa
od3n
#3
it’s not redirect. i have .php file, but no .css file.
if in apache, rewrite rule is like this :
RewriteEngine On
RewriteRule custom.css custom.php [L,QSA]
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220792,220794#msg-220794
od3n
#4
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;
}
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220792,220906#msg-220906
od3n
#5
On 7 Jan 2012 14h00 WET, [email protected] 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
od3n
#6
On 4 Jan 2012 14h41 WET, [email protected] wrote:
it’s not redirect. i have .php file, but no .css file.
if in apache, rewrite rule is like this :
RewriteEngine On
RewriteRule custom.css custom.php [L,QSA]
It’s the other way around:
location ^~ /wp-content/themes/mytheme/assets/css/custom.css {
return 302 /wp-content/themes/mytheme/assets/css/custom.php;
}
— appa