Forum Moderators: phranque
You have not defined a value for it to receive. Nor have you shown an example, so we cannot determine how you might plan to provide a value in the requested URL.
See RewriteRule [httpd.apache.org] in the Apache mod_rewrite documentation, and find and study the term "back-reference" there.
Jim
Substitution of a rewriting rule is the string which is substituted for (or replaces) the original URL for which Pattern matched. Beside plain text you can use1. back-references $N to the RewriteRule pattern
2. back-references %N to the last matched RewriteCond pattern
3. server-variables as in rule condition test-strings (%{VARNAME})
4. mapping-function calls (${mapname:key¦default})Back-references are $N (N=0..9) identifiers which will be replaced by the contents of the Nth group of the matched Pattern. The server-variables are the same as for the TestString of a RewriteCond directive. The mapping-functions come from the RewriteMap directive and are explained there. These three types of variables are expanded in the order of the above list.
If it is not clear, your rule rewrites a client request for the URL "example.com/search" to the filepath <document_root>/search.php?s=<blank>.
To make it work, you need your rule to rewrite a client request for the URL "example.com/search/<something>" to the filepath <document_root>/search.php?s=<something>. For example:
RewriteRule ^search/([^/])+/?$ /search.php?s=$1 [NC,L]
This means several things:
The links on your pages must refer to example.com/search/<something>, with or without a trailing slash. This is the "real" URL on the Web.
There must be a file on your server at <document_root>/search.php which accepts a query string with a name of "s=". This php file is the "real" file on your server.
Mod_rewrite internally rewrites requested URLs to server filepaths, or using an alternate syntax, it can externally redirect one requested URL to another URL. It cannot change the links on your pages; It can only change the local server filepath associated with a URL on the Web.
Mod_rewrite takes action after a client request is received by your server, and before any scripts are invoked or any content is served. It is a URL-to-filename translator or a URL-to-URL redirector, not a "page content filter or modifier."
For more information, see this thread [webmasterworld.com] in our Apache forum library [webmasterworld.com].
Jim