Jump to content

Any friends who use nginx?


kong

Recommended Posts

I would like to inquire about an issue with Nginx server. I have configured multilingual URLs in the background, where accessing www.domain.com automatically redirects to www.domain.com/de, but it shows a '404 NOT FOUND' error. How can I solve this? When I raised a support ticket, the administrator replied that they only handle .htaccess files, and they do not configure Nginx. Could any kind-hearted technical experts please help me? Thank you.

Link to comment
Share on other sites

To add to this question, these are the .htaccess mod_rewrite rules that do the magic for allowing subfolders being used:

RewriteCond %{ENV:REDIRECT_REWRITTEN} !=1
RewriteCond %{ENV:REDIRECT_REDIRECT_REWRITTEN} !=1
RewriteRule ^([a-z]{2})/(.*) /$2 [L,QSA,E=REWRITTEN:1,E=LOCALE:$1]

They translate https://domain.com/de/someurl/ into https://domain.com/someurl/ and add ENV variable REDIRECT_LOCALE = de

Link to comment
Share on other sites

After struggling for half a month, I still couldn't resolve it. Even asking CHATGPT for help with writing code didn't work. There was no other choice but to switch to .htaccess, uninstall Nginx, install Apache. Now the website can be accessed normally. I really don't know why I've been tinkering with it for so long...

Link to comment
Share on other sites

You don't need to uninstall Nginx, Nginx should be normally used as a proxy on top of Apache for static files (JPG, JS, CSS and video files).

Also you can use subdomains for localized versions instead of subfolders. This doesn't require any .htaccess specific rules.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...