Forum Moderators: phranque
None of these exist and never existed, but Google thinks they do.
RedirectMatch permanent ^/?1$ http://www.example.com/
doesn't work
RedirectMatch permanent ^/?1 http://www.example.com/
doesn't work
RedirectMatch permanent ^/?1$ http://www.example.com/page.html
doesn't work
RedirectMatch permanent ^/?1$ http://www.example.com/
does redirect http://www.example.com/1 to
http://www.example.com/ but not
http://www.example.com/$1
Question 1... can I redirect www.example.com/?1 to www.example.com/
Question 2.... can I use some sort of wildcard to redirect all www.example.com/?**** URLS that use a "?" to the root URL? If so, how? (And redirect only "?" URLS, leaving the rest of the domain like www.example.com/dir/ and www.example.com/page.html unaffacted.)
# Redirect home directoryindex page with any query string
# to home directoryindex page without query string
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} .
RewriteRule ^$ http://www.example.com/? [R=301,L]
I'm not sure if you wanted to strip query strings from *all* pages - that was not clear. If so, change the above RewriteRule to:
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
Jim