0 votes
54 views
by Rookie

Hi !
First of all, thanks for Webinoly ! It's really one of the best thing I could see. I appreciates to use it :)
We have a plugin in our side, in 1 site (we are using 3 sites) that requires to add that lines :

# BEGIN Hide My WP

rewrite ^/other/js/embed\.min\.js /wp-includes/js/wp-embed.min.js?UDnMqz_hide_my_wp=1234 last;
rewrite ^/other/(.*) /wp-includes/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/file/(.*) /wp-content/uploads/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/ext/(.*) /wp-content/plugins/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/skin/main\.css /?style_wrapper=1&UDnMqz_hide_my_wp=1234 last;
rewrite ^/skin/style\.css /nothing_404_404?UDnMqz_hide_my_wp=1234 last;
rewrite ^/skin/(.*) /wp-content/themes/twentytwenty/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/ajax /wp-admin/admin-ajax.php?UDnMqz_hide_my_wp=1234 last;
rewrite ^/inc/(.*) /wp-content/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/(readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$)
/nothing_404_404?UDnMqz_hide_my_wp=1234 last;
rewrite ^/(((wp-content|wp-includes)/([A-Za-z0-9\-\_\/]*))|(wp-admin/(!network\/?)([A-Za-z0-9\-\_\/]+)))(\.txt|/)$ /nothing_404_404?UDnMqz_hide_my_wp=1234 last;

# END Hide My WP

It says that we have put these lines before the :
try_files $uri $uri/ /index.php?q=$uri&$args;

As we would like to do this in only 1 site, we tried to create the file : rules-nginx.conf in our /var/www/site directory, and added these lines, but it is not working...

We tried to understand how with your documentation, but we have to say that we are getting a bit "lost" :/
Could you please tell us how to add these "rewrite rules" line for only 1 site ? After that, do we have to restart the nginx server ? And how ? (because we saw the "restart" command, but we are afraid to reset all settings, and not just save the new ones added...

Thanks for your support, and for Webinoly !!

Regards

1 Answer

0 votes
by Expert

Hi ziloub,

First of all, you are doing it great. When you add a file with custom Nginx rules in Webinoly, these rules are the last thing to be loaded, so I'm pretty sure they are not before the "try" directive, I don't know why your plugin is throwing that message.

Nginx should always be restarted to changes take effect: sudo nginx -t && sudo service nginx reload

Regards.

by Rookie
Thanks for your fast feedback!
Could I ask you one more thing please ? So we tried to add these rules with the custom file in our main site directory, but I think we don't know exactly the proper "syntax" to add the rewrite rules (mentioned in the first part) to be ok and charged by the website.
It is possible that you gave us the proper syntax / code to add on the file in order to make it works? We tried many times, but never succeed...

Thanks for your great support !

Regards
by Expert
I'm not really sure about what you're trying to ask. I know nothing about the plugin you are trying to use, surely they have the proper "rewrite rules" you need in order to use it.

Also, you can read our documentation for more info about how to add these rules to Webinoly: https://webinoly.com/en/documentation/sites/#nginx

As I said before, remember that you need to restart Nginx after any modification to changes take effect.
by Rookie
Hi,

Just asked about the "syntax" to add these rules on the custom file for my site.
I tried to add :

location / {rewrite ^/other/js/embed\.min\.js /wp-includes/js/wp-embed.min.js?UDnMqz_hide_my_wp=1234 last;
rewrite ^/other/(.*) /wp-includes/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/file/(.*) /wp-content/uploads/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/ext/(.*) /wp-content/plugins/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/skin/main\.css /?style_wrapper=1&UDnMqz_hide_my_wp=1234 last;
rewrite ^/skin/style\.css /nothing_404_404?UDnMqz_hide_my_wp=1234 last;
rewrite ^/skin/(.*) /wp-content/themes/twentytwenty/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/ajax /wp-admin/admin-ajax.php?UDnMqz_hide_my_wp=1234 last;
rewrite ^/inc/(.*) /wp-content/$1?UDnMqz_hide_my_wp=1234 last;
rewrite ^/(readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$)
/nothing_404_404?UDnMqz_hide_my_wp=1234 last;
rewrite ^/(((wp-content|wp-includes)/([A-Za-z0-9\-\_\/]*))|(wp-admin/(!network\/?)([A-Za-z0-9\-\_\/]+)))(\.txt|/)$ /nothing_404_404?UDnMqz_hide_my_wp=1234 last;
}

and I have that error message :

nginx: [emerg] duplicate location "/" in /var/www/site/rules-nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

So I don't know how to add these specific rules for my site (not for all site), as there is conflict with the main configuration of Nginx.

Regards
by Expert
As I said before, I know nothing about the plugin you're trying to use, surely they have the instructions to make it work in Nginx. Ask them!

The only thing I can say because of the error message you're getting is that you can try removing the "location" block, just leave the rewrite rules.
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

If you have a question about Webinoly, please ask in English or Spanish.

To report a bug, please ask a question here with the bug tag.

Donations

Webinoly Support Paypal Donations Webinoly Support Bitcoin Donations

Your regular donations is what keep this project moving forward. If you like Webinoly, buy me a coffee or a beer to show support.

Affiliate Links

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...