I set a rewrite rule for my WordPress site and I found it partially works.
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)$ $2 [L]
For example, given my rule, https://example.edu/subsite/wp-includes/js/jquery/jquery.js is supposed to redirect to https://example.edu/wp-includes/js/jquery/jquery.js since the subsite and the main site share js files.
However, 404 Not Found | nginx error was thrown.
But if I change the file name to a non-existing file, say https://example.edu/subsite/wp-includes/js/jquery/jquery.jssssssssssss, the server of course cannot find the file and prompted error
"Not Found The requested URL /wp-includes/js/jquery/jquery.jsssss was not found on this server."
But, the redirection was successfully done. (from /subsite/wp-includes/... to /wp-includes/...).
This issue seems like
- If the url is directed to an existing file, it will lead to 404 error,
- If the url is directed to a non-existing file, redirection will be done.
Am I missing something in the redirection rule or anything else? How can I fix this issue?
Aucun commentaire:
Enregistrer un commentaire