Jump to content

Apache help


pgabriel

Recommended Posts

Hello,

I`m trying to rewrite the search.php. I don`t know well apache coding. Maybe you can help me.

 

In search.php (at top) i wrote this:

$string = (isset($_GET["string"])?tnormalise($_GET["string"],":\."):"");
  $usr = (isset($_GET["usr"])?intval($_GET["usr"]):0);

  if ($usr)
  {
    $url = $baseHREF."search/".urlencode($string);

    header("Location: ".$url);

    exit();
  }

 

The search form:

<form action="<?php print $baseHREF; ?>search.php">
              		<p>
              		<b>Search in:</b>  
              		<input type="radio" name="search" value="Description" checked> Description  
              		<input type="radio" name="search" value="Keywords"> Keywords  
              		<input type="radio" name="search" value="Title"> Title  
              		<input type="radio" name="search" value="Company"> Company
              		</p><p>
              		<b>Search for:</b>  
              		<input type="text" size="50" name="string" value="<?php print (isset($string)?$string:""); ?>"> <input type="submit" value="Search">
				<input type='hidden' name='usr' value='1' />
              		</p><p>
              		<b>Match:</b>  
              		<input type="radio" name="match" value="Any" checked> Any word  
              		<input type="radio" name="match" value="All"> All words  
              		<input type="radio" name="match" value="Exact"> Exact phrase
              		</p>
            		</form>

 

I`ve tried something with apache but.. doesn`t work:

RewriteRule ^search/(.*)$ search.php?string=$1{QUERY_STRING} [L]

 

I would like the search to look like this:

domain.com/search/search+string

 

 

Now it looks like this:

search.php?search=Description&string=searched+word&usr=1&match=Any

Where "Description" and "Any" are some values from search form.

 

Thanks a lot!

Link to comment
https://forums.phpfreaks.com/topic/52378-apache-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.