繁体   English   中英

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

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

我最近从代码峡谷购买了一个脚本,似乎在实时服务器上工作正常,但在WAMP(Apache版本:2.2.22)上没有,脚本的要求是mod-rewrite应该打开并且它似乎在

在此输入图像描述

在wamp的www文件夹中,我的代码驻留在名为jobs文件夹中,这就是我访问它的方式http://localhost/jobs但是每次它将我重定向到http://localhost/jobs/US/而我所看到的就是WAMP服务器配置屏幕。

在实时服务器上,这就是.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>

我没有使用.htaccess那么多,所以我不知道如何使脚本在localhost上工作,我确实尝试将RewriteBaseRewriteBase /更改为RewriteBase /jobs但这也无效。

我在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

如果有人能告诉我我做错了什么或者如何让它在localhost上工作,我真的很感激。

我在.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>

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

我通过研究localhost上的wordpress .htaccess文件得到了它的工作,并找到了一个解决方案,因为脚本位于一个名为jobs的文件夹中,我需要通过执行此RewriteRule . jobs/index.php [L]将其添加到.htaccess文件中RewriteRule . jobs/index.php [L] RewriteRule . jobs/index.php [L]

这是完整的.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>

这解决了我的问题。

暂无
暂无

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

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