简体   繁体   English

脚本在实时服务器上正常运行但在wamp上运行不正常

[英]Script running fine on live server but not on wamp

I recently bought a script from code canyon that seems to be working fine on live server, but not on WAMP (Apache Version :2.2.22 ), the requirement of the script is that mod-rewrite should be on and it seems to be on 我最近从代码峡谷购买了一个脚本,似乎在实时服务器上工作正常,但在WAMP(Apache版本:2.2.22)上没有,脚本的要求是mod-rewrite应该打开并且它似乎在

在此输入图像描述

In www folder of wamp my code resides inside folder called jobs and this is how i am accessing it http://localhost/jobs But each time it redirects me to http://localhost/jobs/US/ and all i see is WAMP Server Configuration Screen. 在wamp的www文件夹中,我的代码驻留在名为jobs文件夹中,这就是我访问它的方式http://localhost/jobs但是每次它将我重定向到http://localhost/jobs/US/而我所看到的就是WAMP服务器配置屏幕。

On live server this is what .htaccess looks like 在实时服务器上,这就是.htaccess样子

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^careers.clickteck.com
RewriteRule ^(.*)$ http://www.careers.clickteck.com/$1 [R=permanent,L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I have not worked with .htaccess that much so i am not sure what to do to make the script work on localhost, I did try to change RewriteBase from RewriteBase / to RewriteBase /jobs but that did not work either. 我没有使用.htaccess那么多,所以我不知道如何使脚本在localhost上工作,我确实尝试将RewriteBaseRewriteBase /更改为RewriteBase /jobs但这也无效。

I do not see anything inside apache error log , however I see this code in apache access log 我在apache error log没有看到任何内容,但是我在apache access log看到了这段代码

127.0.0.1 - - [25/Jul/2014:22:32:41 +0500] "GET /jobs/ HTTP/1.1" 302 -
127.0.0.1 - - [25/Jul/2014:22:32:42 +0500] "GET /jobs/US/ HTTP/1.1" 200 5924
127.0.0.1 - - [25/Jul/2014:22:32:43 +0500] "GET /jobs/US/index.php?img=pngFolder HTTP/1.1" 200 850
127.0.0.1 - - [25/Jul/2014:22:32:43 +0500] "GET /jobs/US/index.php?img=gifLogo HTTP/1.1" 200 4549
127.0.0.1 - - [25/Jul/2014:22:32:43 +0500] "GET /jobs/US/index.php?img=pngWrench HTTP/1.1" 200 741
127.0.0.1 - - [25/Jul/2014:22:32:43 +0500] "GET /jobs/US/index.php?img=pngPlugin HTTP/1.1" 200 548
127.0.0.1 - - [25/Jul/2014:22:32:43 +0500] "GET /jobs/US/index.php?img=pngFolderGo HTTP/1.1" 200 694

I will really really appreciate if anyone can tell me what am i doing wrong or how to get it to work on localhost. 如果有人能告诉我我做错了什么或者如何让它在localhost上工作,我真的很感激。

SOLUTION

I made the following change in .htaccess which solved the problem 我在.htaccess做了以下更改,解决了这个问题

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
--->   RewriteRule . jobs/index.php [L]   <----

</IfModule>

Delete RewriteBase / . 删除RewriteBase / Replace RewriteRule . index.php [L] 替换RewriteRule . index.php [L] RewriteRule . index.php [L] instead of RewriteRule . /index.php [L] RewriteRule . index.php [L]而不是RewriteRule . /index.php [L] RewriteRule . /index.php [L]

I got it to work by studying wordpress .htaccess file on localhost and came to a solution that since the script resides inside a folder called jobs I needed to add this in .htaccess file also by doing this RewriteRule . jobs/index.php [L] 我通过研究localhost上的wordpress .htaccess文件得到了它的工作,并找到了一个解决方案,因为脚本位于一个名为jobs的文件夹中,我需要通过执行此RewriteRule . jobs/index.php [L]将其添加到.htaccess文件中RewriteRule . jobs/index.php [L] RewriteRule . jobs/index.php [L] . RewriteRule . jobs/index.php [L]

This is the complete .htaccess code 这是完整的.htaccess代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . jobs/index.php [L]
</IfModule>

This solved my problem. 这解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM