我刚将我的网站转移到新服务器上,我遇到了问题。
以前,以下内容可行:
var ajaxURL = 'http://www.example.com/cart/?parameter=1';
ajaxCaptureRequest = $.post( ajaxURL, { cart_action: "capture", firstName: $('#firstName').val(), totalSub: $('#totalSub').val() }, function(data){});
现在在我的新服务器上它不起作用。但是,如果我将ajaxURL更改为:
var ajaxURL = 'http://www.example.com/cart/index.php?parameter=1';
它有效。
由于愚蠢的原因,我不能像这样永久地更改代码,所以它必须没有ajaxURL变量中的'index.php'。
为了完成这项工作,我需要更改哪些设置?
答案 0 :(得分:0)
如果您正在使用anyframeworks或其他任何可以删除index.php的出现,如periovus stackoverflow答案中提到
网址:: https://stackoverflow.com/a/4365161/4119740
你可以在.htaccess文件中写下以下几行
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
希望这可以解决您的问题