Forum Moderators: phranque
I need your help for having my redirection directives in a .htaccess file work.
I need to redirect all the requests for:
[olddomain.com...]
to:
[nicestuff.com...]
and any request for the main url:
[olddomain.com...]
to:
[nicestuff.com...]
(or just to [/www.nicestuff.com/)...]
I've been trying with every possible combination of RedirectMatch, like for example:
RedirectMatch permanent ^/nicestuff/?lang=(.*)$ "http://www.nicestuff.com/$1"
RedirectMatch permanent ^/nicestuff$ "http://www.nicestuff.com/"
or
RedirectMatch permanent ^lang=(.*)$ "http://www.nicestuff.com/$1"
RedirectMatch permanent ^/nicestuff$ "http://www.nicestuff.com/"
but for some reason the second directive catches all, so I have requests like:
[olddomain.com...]
redirected to
[nicestuff.com...]
instead of
[nicestuff.com...] :(
Where am I wrong?
I cannot use rewrite rules because they are not allowed on the old server.
Thanks in advance for your help,
-- Dario
Welcome to WebmasterWorld [webmasterworld.com]!
I've seen posts to the contrary, but as far as I know, there is no reliable way to handle query strings attached to URLs using Redirect or RedirectMatch. Take a look at mod_rewrite, using RewriteCond to check %{QUERY_STRING} and RewriteRule to do the redirection.
By way of explanation, a query string is not considered to be part of a URL. Rather it is attached "data" to be passed to the resource *at* that URL. So, query strings are handled separately from URLs in many servers.
Jim