By newbie
Hi, i need to convert bellow htaccess rule for my nginx server. i have tried to convert and bellow is my result. unfortunately its not working. can somebody tell me where i have done wrong?
Original htaccess rule
RewriteRule ^file/(.*) /wp-content/uploads/$1?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^ext/(.*) /wp-content/plugins/$1?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^skin/([_0-9a-zA-Z-]+)/main.css /index.php?style_wrapper=true&template_wrapper=$1&sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^skin/([_0-9a-zA-Z-]+)/style\.css /nothing_404_404?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^skin/(.*) /wp-content/themes/$1?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^([_0-9a-zA-Z-]+/)?ajax /wp-admin/admin-ajax.php?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^inc/(.*) /wp-content/$1?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^(readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$) /nothing_404_404?sEyM_hide_my_wp=1234 [QSA,L]
RewriteRule ^(((wp-content|wp-includes)/([A-Za-z0-9\-\_\/]*))|(wp-admin/(!network\/?)([A-Za-z0-9\-\_\/]+)))(\.txt|/)$ /nothing_404_404?sEyM_hide_my_wp=1234 [QSA,L]```
Converted Nginx rule
location /other { rewrite ^/other/(.*) /wp-includes/$1?sEyM_hide_my_wp=1234 break; }
location /file {
rewrite ^/file/(.*) /wp-content/uploads/$1?sEyM_hide_my_wp=1234 break; }
location /ext {
rewrite ^/ext/(.*) /wp-content/plugins/$1?sEyM_hide_my_wp=1234 break; }
location /skin {
rewrite ^/skin/([_0-9a-zA-Z-]+)/main.css /index.php?style_wrapper=true&template_wrapper=$1&sEyM_hide_my_wp=1234 break;
rewrite ^/skin/([_0-9a-zA-Z-]+)/style\.css /nothing_404_404?sEyM_hide_my_wp=1234 break;
rewrite ^/skin/(.*) /wp-content/themes/$1?sEyM_hide_my_wp=1234 break; }
location /inc {
rewrite ^/inc/(.*) /wp-content/$1?sEyM_hide_my_wp=1234 break; }
location / {
try_files $uri $uri/ /index.php$is_args$args;
# try_files $uri $uri/ /index.html;
# try_files $uri $uri/ =404;
rewrite ^/([_0-9a-zA-Z-]+/)?ajax /wp-admin/admin-ajax.php?sEyM_hide_my_wp=1234 break;
rewrite ^/(readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$) /nothing_404_404?sEyM_hide_my_wp=1234 break;
rewrite ^/(((wp-content|wp-includes)/([A-Za-z0-9\-\_\/]*))|(wp-admin/(!network\/?)([A-Za-z0-9\-\_\/]+)))(\.txt|/)$ /nothing_404_404?sEyM_hide_my_wp=1234 break;
}
thanks in advance.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The correct result is as below -
location /other {
rewrite ^/other/(.*) /wp-includes/$1?sEyM_hide_my_wp=1234 break;
}
location /file {
rewrite ^/file/(.*) /wp-content/uploads/$1?sEyM_hide_my_wp=1234 break;
}
location /ext {
rewrite ^/ext/(.*) /wp-content/plugins/$1?sEyM_hide_my_wp=1234 break;
}
location /skin {
rewrite ^/skin/([_0-9a-zA-Z-]+)/main.css /index.php?style_wrapper=true&template_wrapper=$1&sEyM_hide_my_wp=1234 break;
rewrite ^/skin/([_0-9a-zA-Z-]+)/style\.css /nothing_404_404?sEyM_hide_my_wp=1234 break;
rewrite ^/skin/(.*) /wp-content/themes/$1?sEyM_hide_my_wp=1234 break;
}
location / {
rewrite ^/([_0-9a-zA-Z-]+/)?ajax /wp-admin/admin-ajax.php?sEyM_hide_my_wp=1234 break;
rewrite ^/(readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$) /nothing_404_404?sEyM_hide_my_wp=1234 break;
rewrite ^/(((wp-content|wp-includes)/([A-Za-z0-9\-\_\/]*))|(wp-admin/(!network\/?)([A-Za-z0-9\-\_\/]+)))(\.txt|/)$ /nothing_404_404?sEyM_hide_my_wp=1234 break;
}
location /inc {
rewrite ^/inc/(.*) /wp-content/$1?sEyM_hide_my_wp=1234 break;
}
If you’re trying to add rules for the Hide My WP plugin, they have Nginx settings in their documentation - http://support.wpwave.com/docs/hide-my-wp/#nginx_config
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.