X
X
Xrist1An2014-12-06 03:48:38
PHP
Xrist1An, 2014-12-06 03:48:38

Why does this rewrite rule rule not work?

RewriteRule ^?s=([A-Za-z0-9-]+)$ page.php?s=$1 [PT]
The idea is to have an address like domain.com/?s=cars parsed to domain.com/ page.php?s=cars
But that doesn't happen. Where is the mistake?
PS index page: index.php

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2014-12-06
@SagePtr

Because the parameters (after ?) need to be checked and overwritten separately.
Here are examples: statichtml.com/2010/mod-rewrite-baseon-on-query-st...

X
Xrist1An, 2014-12-06
@Xrist1An

Apparently it will be easier to make a redirect.
From domain.com/?s=cars to domain.com/cars Tell me
how to implement this?
Tried like this:
RewriteCond %{QUERY_STRING} ^s=(.*)
RewriteRule ^/$ /%1 [R=301]
But it eventually redirects to domain.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question