Reputation: 143
I have (for example) site help.test.pl
I would like redicrect from subsite help.test.pl/site1
to another URL of this site: help.test.pl/site1/info/sport
If I do in apache:
Redirect 301 /site1 https://help.test.pl/site1/info/sport
and If i run site help.test.pl/site1
in my browser the "info/sport/
" of URL is looped.
The URL look like:
https://help.test.pl/site1/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport/info/sport
What am I doing wrong?
Upvotes: 1
Views: 987
Reputation: 1633
You can use one method from below :
1) Using RewriteRule
.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} /site1$
RewriteRule ^/?(.*)$ https://help.test.pl/site1/info/sport [R=301,L]
2) Using RedirectMatch
RedirectMatch 301 /site1$ https://help.test.pl/site1/info/sport
EDIT: add another page.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} /site1$ [OR]
RewriteCond %{REQUEST_URI} /site2$
RewriteRule ^/?(.*)$ https://help.test.pl/$1/info/sport [R=301,L]
Upvotes: 1