Forum Moderators: phranque
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.+)$ /index.php/$1
</IfModule>
# END WordPress
Everything is working nicely with the exception of the search form, which only delivers a result when the search is made from the homepage.
From the homepage I get a successful search result with:
ht*p://www.site.com/?s=Word+Anotherword
When searching from other pages I am seeing unsuccessful search results, eg:
ht*p://www.site.com/index.php/folder/my-page?s=Word+Anotherword
ht*p://www.site.com/index.php/my-page?s=Word+Anotherword
I've tried various RewriteRules, but either nothing changes or else I see an internal server error. The last one I used was:
RewriteRule ^(index\.php)(/[a-z-/]+)(\?s=)([[:alnum:]+][\+]+)$ /$3$4 [L]
This one produces an internal server error. I don't see why though. In the first bracketed part I've escaped the dot. In the second brackets I am matching any combination of letters, hyphens, and forward slashes - all preceded by a forward slash. In the third brackets I am matching "?s=" and in the fourth, any combination of letters or numbers and plus signs. Obviously there are some blunders somewhere.
The aim is to see in the address bar:
ht*p://www.site.com/?s=whatever+they+searched+for
... no matter which page the search is made from.
This will work better:
RewriteCond %{QUERY_STRING} ^(s=([0-9a-z]\+?)+)$ [NC]
RewriteRule ^index\.php/.+$ /?%1 [L]
Jim