After asking this question: Clean URLs for search query? I tried something with mod_rewrite:
RewriteCond %{QUERY_STRING} ^s=([a-z]+)$ [NC]
RewriteRule / /s/$1? [NC,R=301,L]
RewriteRule ^s/([a-z]+)$ /?s=$1 [NC,L]
What's the goal?
- Redirect http://example.com/?s=query to http://example.com/s/query
- Rewrite http://example.com/s/query to http://example.com/?s=query
This looks like double work but if you take a good look you see what I try to accomplish:
- Redirect any search querystring to a cleaner equivalent (be it a form, or somebody typing it in directly)
- Rewrite (not redirect) that URL back to dynamic querystring so that I can get it with PHP via $_GET
If I think about it like this it should be possible. So I would like to seek the help of the experienced mod rewriter to help me out with this one.
Number 2 works but that's it.