A pretty URL for a specific PHP page?

Александр Кириллов nevis2us at gmail.com
Sun Sep 12 07:59:29 UTC 2021


Try

rewrite ^/report/$ /index.php?r=app%2Fform&id=2lyEsw last;

пн, 6 сент. 2021 г. в 07:59, Jore <community at thoughtmaybe.com>:

> Hi there,
>
> Is it possible to make a pretty URL for a specific PHP page?
>
> I'd like https://domain.com/report/ to render
> https://domain.com/index.php?r=app%2Fform&id=2lyEsw
>
> So I tried this location block, but I get 403 forbidden:
>
>     location /report {
>         index index.php?r=app%2Fform&id=2lyEsw;
>         alias /var/www/easyforms;
>     }
>
>
>
> Here's my whole config:
>
>
> server {
>     listen       443 ssl http2;
>     server_name  report.DOMAIN.COM;
>     root /var/www/easyforms;
>     gzip on;
>     ssl_certificate /var/lib/acmesh/report.DOMAIN.COM/fullchain.cer;
>     ssl_certificate_key
> /var/lib/acmesh/report.DOMAIN.COM/report.DOMAIN.COM.key;
>     ssl_protocols TLSv1.2;
>     ssl_prefer_server_ciphers on;
>     ssl_ciphers
>
> 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES12$
>     ssl_session_cache shared:SSL:5m;
>     ssl_session_timeout 10m;
>
>     location /report {
>         index index.php?r=app%2Fform&id=2lyEsw;
>         alias /var/www/easyforms;
>     }
>
>     location / {
>         index index.php index.html;
>         try_files $uri $uri/ /index.php?$args;
>     }
>
>     location ~ \.php$ {
>         include fastcgi.conf;
>         fastcgi_intercept_errors on;
>         include fastcgi_params;
>         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>         fastcgi_pass unix:/run/php/php-fpm.sock;
>         fastcgi_index index.php;
>         fastcgi_read_timeout 300s;
>     }
> }
>
>
> What am I doing wrong?
>
> Thanks!
> Jore
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20210912/b1f745e2/attachment.htm>


More information about the nginx mailing list