Home  >  Q&A  >  body text

How to rewrite url website in nginx when there are many sites in the server

I want to rewrite url in nginx, but the server Ubuntu has many sites.

Rewrite friendly url in php website.

P粉697408921P粉697408921306 days ago372

reply all(1)I'll reply

  • P粉768045522

    P粉7680455222024-01-11 15:15:57

    You can use rewrite rules from nginx possibilities. For example

    server {
       listen 80;
       listen 443 ssl;
       server_name www.site1.com site1.com;
    
    
       location=/your-url
       {
    
         rewrite a.php= ^my-desires([0-9]+)$ break;
       }
    
       ....
       ....
    }

    Also, you can view rewrite-modules from https://www.nginx.com/blog/creating-nginx-rewrite-rules/

    reply
    0
  • Cancelreply