Reputation: 213
I want to redirect from http://example.com/contact-us to http://example.com/contact-us/offices
I have written following line in my .htaccess:
Redirect 301 /contact-us/ http://example.com/contact-us/offices
But when I visit to http://example.com/contact-us then it redirects to http://example.com/contact-us/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/offices/
Upvotes: 1
Views: 244
Reputation: 785156
You are using this rule:
Redirect 301 /contact-us/ http://example.com/contact-us/offices
That is redirecting every URL that starts with /contact-us/
new URL that is /contact-us/offices
. Since redirecting URL also starts with /contact-us/
therefore redirect will happen again and again causing a redirect loop. In order to avoid this situation use RedirectMatch
that has regex support so that you can control the matching pattern.
RedirectMatch 301 ^/contact-us/?$ http://example.com/contact-us/offices
Don't forget to clear your browser cache before testing this change.
Upvotes: 1
Reputation: 7476
If you are redirecting to same host use below rule and then after clearing cache try this url to reach http://example.com/contact-us/
use forward slash too.
Redirect 301 /contact-us/ /contact-us/offices/
Upvotes: 0