URL可以在localhost上正常工作,而不能在Web服务器上工作

问题描述:

我尝试了此处发布的其他解决方案,但没有任何效果。

I've tried other solutions posted here, but nothing worked..

我在.htaccess文档上有以下代码。

I have the following code on .htaccess doc.

RewriteEngine On
RewriteRule ^registrationForm/([a-zA-Z0-9_-]+)$ registrationForm.php?code=$1
RewriteRule ^registrationForm/([a-zA-Z0-9_-]+)/$ registrationForm.php?code=$1

我收到一封电子邮件,然后单击url,就可以访问registrationForm.php

I receive an email and by clicking on the url I get access to registrationForm.php

我像这样启动registrationForm.php:

I start registrationForm.php like that:

<?php
if (!empty($_GET['code']) && isset($_GET['code']))
{
    $code=$_GET['code'];

有人知道为什么它可以在本地主机上运行但不能在远程服务器上运行吗?

Do someone knows why this works on localhost but not on remote server?

问题不是您在获取代码时如何运行代码。问题可能在这里发生。

The problem is not how you got the code running in acquiring the code. The problem could have occurred here.

if (!empty($_GET['code']) && isset($_GET['code']))
{
    $code=$_GET['code'];

上面的代码行无法获取代码部分,它是查询字符串的一部分。生成的查询字符串中没有单词 code 。您可能需要阅读此文章

The line of code above was not able to get the code part which is part of your querystring. The querystring that has been generated doesn't have the word code in it. You may want to read this article.