Reputation: 1347
I need to redirect some pages from one domen to another. Example:
example.com/help/questions(/show/some_text|none|get params)
to example2.com/questions(/show/some_text|none|get params)
htaccess:
Redirect permanent /help/questions http://example2.com/questions
But redirect from example.com/help/questions/show/some_text
doesn't work - I have example2.com/help/questions/show/some_text
instead example2.com/questions/show/some_text
With such code I have some problem.
RewriteCond %{HTTP_HOST} example.com/help/questions
RewriteRule (.*) http://example2.com/questions/$1 [R=301,L]
How I can fix it? All another pages redirect normally.
Upvotes: 2
Views: 46
Reputation: 785316
%{HTTP_HOST}
only matches host name not URI.
You can use:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?example\.com$ [NC]
RewriteRule ^help/(questions/.*) http://example2.com/$1 [R=301,L,NC,NE]
Upvotes: 1
Reputation: 863
Upvotes: 0