3

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

enter image description here

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.

On live server this is what .htaccess looks like

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

I do not see anything inside apache error log, however I see this code in 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.

SOLUTION

I made the following change in .htaccess which solved the problem

<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>
Shairyar
  • 3,268
  • 7
  • 46
  • 86
  • 2
    Since you bought a script from code canyon, have you tried asking code canyon for help? I don't mean to dismiss your question here, but they might know their script better than the SO community, and might have a particular work-around for WAMP vs LAMP. – TecBrat Jul 25 '14 at 17:54
  • @TecBrat yes I contacted the author, been waiting for 4 days now so thought of asking here. – Shairyar Jul 25 '14 at 18:11
  • @Baig don't be afraid of putting your solution in an actual answer; you can even accept it as such – Félix Adriyel Gagnon-Grenier Jul 25 '14 at 18:15
  • @FélixGagnon-Grenier thanks, I guess i should do that in case someone in future comes across the same scenario. thank you :) – Shairyar Jul 25 '14 at 18:16

2 Answers2

1

Delete RewriteBase /. Replace RewriteRule . index.php [L] instead of RewriteRule . /index.php [L]

Avinash Babu
  • 6,171
  • 3
  • 21
  • 26
1

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 thisRewriteRule . jobs/index.php [L].

This is the complete .htaccess code

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

Shairyar
  • 3,268
  • 7
  • 46
  • 86