Jump to content

Redirecting search.php with .htaccess


etrader

Recommended Posts

I have a search box with this code

<form method="get" action="/search.php">
<div>
<input type="text" value="" name="q" size="30" onclick="this.value='';" />
<input type=submit value='Search' ">
</div>
</form>

and .htaccess of

RewriteRule ^search/(.*).html search.php?q=$1 [L]

 

Now, if typing "mysite.com/search/$q.html" it works perfectly as well as "mysite.com/search.php?q=$q"; but my problem is that

 

1. I expect redirecting to "mysite.com/search/$q.html" when typing "mysite.com/search.php?q=$q" (I mean on the browser url place).

 

2. More importantly, when searching something in the search box, it sends to "mysite.com/search.php?q=$q", but not "mysite.com/search/$q.html"

 

:-\

 

 

Link to comment
https://forums.phpfreaks.com/topic/225484-redirecting-searchphp-with-htaccess/
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.