Quantcast
Channel: help – WordPress.org Forums
Viewing all articles
Browse latest Browse all 13924

mikblik on "Search results problem from DNS redirection"

$
0
0

In case anyone else has this problem, the solution is very simple. You just need to add a few lines of code to your ".htaccess" file.

My redirects are setup to redirect all "mihaelblikshteyn.com" and "www.mihaelblikshteyn.com" traffic to my SmugMug account at "archive.mihaelblikshteyn.com". This messed with WordPress search as WordPress tried to display search results as "mihaelblikshteyn.com/?s=search-term" and the redirect would take it to SmugMug. With the below code, WordPress search results are forced to be displayed as "www.mihaelblikshteyn.com/search/search-term".

# search redirect
# this will take anything in the query string, minus any extraneous values, and turn them into a clean working url
RewriteCond %{QUERY_STRING} \\?s=([^&]+) [NC]
RewriteRule ^$ http://www.mihaelblikshteyn.com/search/%1/? [NC,R,L]

Viewing all articles
Browse latest Browse all 13924

Trending Articles