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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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