Jump to content

About Mod Rewrite (Win+Apache)


cnrars

Recommended Posts

Hi all,

 

Please help me about mod rewrite using Apache on WinVista,

 

Pls check my codes

 

HTML> 
<HEAD> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<TITLE>Articles Search</TITLE> 
<meta name="generator" content="Namo WebEditor v5.0">
</HEAD> 
<BODY> 
<CENTER> 
<BR><BR> 
<FORM NAME="ArticlesSearch" ACTION="Search.php" METHOD="POST"> 
<INPUT TYPE="TEXT" NAME="SearchString"> 
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Search"> 
</FORM> 
</CENTER> 
</BODY> 
</HTML> 

 

PHP (Paging)

 

<? 
header("Content-Type: text/html; charset=ISO-8859-9"); 

//Connect to DB 
mysql_connect("localhost","root","eskom0661") or die("Unable to connect to SQL server"); 
mysql_select_db("eskomweb") or die("Unable to SELECT DB"); 

mysql_query("SET NAMES 'latin5'"); 

$Limit = 5; //Number of results per page 
$SearchString=$_POST["SearchString"]; // Get the search tearm 
If($SearchString == "") $SearchString=$_GET["SearchString"]; // Get the search tearm 
If($SearchString == "") { 
Echo"Nothing to Search For"; 
exit(); 
} 
$page=$_GET["page"]; //Get the page number to show 
If($page == "") $page=1; //If no page number is set, the default page is 1 

//Get the number of results 
$SearchResult=mysql_query("SELECT * FROM cat WHERE CatName LIKE '%$SearchString%' ORDER BY ID") or die(mysql_error()); 
$NumberOfResults=mysql_num_rows($SearchResult); 

//Get the number of pages 
$NumberOfPages=ceil($NumberOfResults/$Limit); 

$SearchResult=mysql_query("SELECT * FROM cat WHERE CatName LIKE '%$SearchString%' ORDER BY ID LIMIT " . ($page-1)*$Limit . ",$Limit") or die(mysql_error()); 

While($row = mysql_fetch_object($SearchResult)) { 
Echo $row->CatName . "<BR>"; 
} 

$Nav=""; 
If($page > 1) { 
$Nav .= " <A HREF=\"Search.php?page=" . ($page-1) . "&SearchString=" .urlencode($SearchString) . "\"><< Prev</A> "; 
} 
For($i = 1 ; $i <= $NumberOfPages ; $i++) { 
If($i == $page) { 
$Nav .= " <B> $i </B> "; 
}Else{ 
$Nav .= "<A HREF=\"Search.php?page=" . $i . "&SearchString=" .urlencode($SearchString) . "\">$i</A>"; 
} 
} 
If($page < $NumberOfPages) { 
$Nav .= "<A HREF=\"Search.php?page=" . ($page+1) . "&SearchString=" .urlencode($SearchString) . "\">Next >></A>"; 
} 

Echo "<BR><BR>" . $Nav; 
?> 

 

 

.htaccess code:

 

Options +FollowSymLinks

RewriteEngine on

RewriteRule Search-page-(.*)-SearchString-(.*)\.htm$  /listeleme/Search.php?page=$1&SearchString=$2&

 

 

httpd.conf

 

LoadModule rewrite_module modules/mod_rewrite.so

 

 

<Directory "C:/php/www">

    Options Indexes FollowSymLinks MultiViews

    AllowOverride All

    Order allow,deny

    Allow from all

</directory>

 

But is not work. Please help me,

 

Thank you.

 

 

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.