Jump to content

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

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.