0

I'm using htaccess friendly URL for profile page, for example:

RewriteRule ^([^/]+)/?$ profile.php?id=$1 [L]

and if i open link for example /some-user it works ok, and opens profile page.

Now inside this profile page i have search form,and how can i get a search value from link because when i submit i get this kind of link: /some-user?search=somekeywod

When submit i need to open url for that profile with search value.

My search form is simple:

<div class="input-group md-form form-sm form-2 pl-0">
  <input class="form-control my-0 py-1 lime-border" type="text" placeholder="Search..." name="search" aria-label="Search">
  <div class="input-group-append">
    <button type="submit" class="input-group-text lime lighten-2" id="basic-text1"><i class="fa fa-search text-grey"
        aria-hidden="true"></i></button>
  </div>
    </form>```
Adel
  • 45
  • 7
  • Does this answer your question? [Rewrite GET Query String using .htaccess](https://stackoverflow.com/questions/34013698/rewrite-get-query-string-using-htaccess) – El_Vanja Nov 25 '20 at 16:18
  • No. I have rewrite for profile.php?id=some-user to /some-user. Now inside that i need to use search form inside that user profile, so if i hit search it needs to open that user profile and give me $_GET["search"] value. – Adel Nov 25 '20 at 17:20

1 Answers1

0

Try this in your htaccess file

RewriteEngine on
RewriteRule ^/profile/([0-9]+)/ /profile.php?id=$1 
Sergiu
  • 73
  • 7