0

I am having trouble with the RewriteRule. I have created a pretty URL for my search page where it posts to itself to query the results. However the $_GET['type'] variable is not being sent to the page. This works perfectly fine on my local WAMP server but does not return a result on my Live hosted server.

e.g. http://..com/search/searchType/ SearchType being the $_GET['type'] data I am sending to the page.

My .HTACCESS is as follows

RewriteEngine On
RewriteRule ^property/(.*)/(.*)/([0-9]+)/$ view_property.php?type=$1&id=$3 [L]
RewriteRule ^search/(.*)/ search.php?type=$1 [L]
A Star
  • 605
  • 9
  • 18
  • Does your production server's Apache config allow override via htacess? – Mike Brant Jun 17 '13 at 23:51
  • The `RewriteRule` creates the pretty url just fine if that's what you are referring to. Otherwise I am not sure (I can ask). Is it possible there are specific settings in the `httpd.conf` that would disable such a feature? As I could disable this on my local server to test this out. – A Star Jun 18 '13 at 00:02
  • Rewrite rules don't create the pretty URL's they just redirect the pretty URL's to an appropriate script. So if you have a GET that is going to a pretty URL, but the pretty URL is not being redirected properly, you are not going to get the data passed correctly. When you say this works in test environment but not in production, my first inclination would be to look at web server configuration. – Mike Brant Jun 18 '13 at 00:07

1 Answers1

1

The problem is because there is a conflict with the file name search.php, which broke the RewriteRule which started with the text 'search'.

After discovering this and doing more research I found that including Options -MultiViews which disables the mod_negotiation MultiViews.

This must have been enabled on my Live hosted server and disabled on my local host. I will find out and update shortly.

Another fix is to rename the RewriteRule URL to something other than ^search/ or any other name that currently exists as another file to remove this conflict.

A Star
  • 605
  • 9
  • 18