R
R
Roman2015-07-26 19:00:32
HTML
Roman, 2015-07-26 19:00:32

How to make the correct URL?

There is a search form

<form action="/search.php" method="get">
<input type="text" name="w">
<button type="submit" style="display: none;"></button>
</form>

and there is a working rule in .htaccess
RewriteRule ^search/([a-z,A-Z,0-9,-]+)/?$ /search.php?w=$1 [L,QSA]

When submitting the form, the URL looks like this /search.php?w=word , but such a URL /search/word also works thanks to .htaccess, but how to make it redirect to a second, more understandable URL immediately after submitting the form?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Malinochkin, 2015-07-26
@DiAsCrafts

Alternatively, just redirect it using JS. This means that you need to catch the form submission, build the address based on the entered data and redirect to the required address.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question