0
我刚刚推出了一个WordPress网站,其中有一个表单,允许用户选择他们想要购买的东西。我们正在实施第三方购物车服务,要求网址采用非常特定的格式。我想要检索POST的变量,然后发出重定向(基本上是一个GET)到这个第三方购物车。我打算创建一个buy.php文件来完成这个工作 - 检索POST变量并创建url。在WordPress托管网站上公开PHP文件
问题是我不知道如何显示buy.php页面。我一直在路由到404.html页面。
我想我会创建一个位于所有其他位置之前的新位置,但服务器日志抱怨无法找到该文件。一旦我解决了这个问题,文件没有被触及,但是请求是由404页面处理的。
服务器运行Nginx。配置如下:
server {
access_log off;
error_log /var/log/site-name.com_error_log;
root /var/www/vhosts/site-name.com/httpdocs;
listen 80;
listen 443 ssl;
ssl_certificate /XXX.pem;
ssl_certificate_key /XXX-cert.key;
# server_name www.site-name.com ;
server_name site-name.com ;
# i can't get this /buy to work
location /buy/ {
# what do I put here to be used in a form Action
}
location/{
root /var/www/vhosts/site-name.com/httpdocs;
index index.html index.php index.htm;
try_files $uri $uri/ /index.php?$args;
}
location @handler {
rewrite//index.php;
}
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ {
try_files $uri /index.php;
expires off;
fastcgi_pass 127.0.0.1:8080;
fastcgi_buffers 256 4k;
fastcgi_buffer_size 32k;
fastcgi_busy_buffers_size 256k;
fastcgi_read_timeout 3600s;
# fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;
}
# WordPress single site rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|woff|woff2|ttf)$ {
expires 365d; access_log off; log_not_found off;
}
}
您需要提供更多的信息,等,其中你的PHP脚本,你为什么不设置你的表格,等在行动另外你是否正在实施自己的购物车? – cmorrissey
我在上面添加了更多信息。我们正在使用第三方购物车提供商。 – Scott