Mobile app version of vmapp.org
Login or Join
Bryan171

: How to solve looping redirect? I have merged my site from Joomla to WordPress. Old domain: www.example.com/about-us.html www.example.com/services-skills.html www.example.com/services-skills2.html New domain:

@Bryan171

Posted in: #301Redirect

I have merged my site from Joomla to WordPress.

Old domain:

example.com/about-us.html www.example.com/services-skills.html example.com/services-skills2.html

New domain:

example.com/about-us www.example.com/services-skills example.com/services-skills2

.htaccess configuration:

Redirect 301 /example.com/services-skills.html example.com/services-skills


and I get a looping error. Any way to solve this?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

3 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

To figure out why your redirect is looping you need to see the redirects happening. One way of doing so is using a command line tool such as curl. Fetch the head of the page:

curl --head www.example.com/about-us.html

and look for the Location: line to see where the redirect goes. Fetch that URL as well to see where it goes. Keep doing so until you see a loop or a page without a redirect.

You could also use the developer console on Firefox or Chrome that show a list of URLs fetched in the "Network" tab. I've also relied on the Firefox plugin called "Live HTTP Headers" that show all the headers for requests made in the browser.

In your case you will likely find that your redirect is not going where you think it is. Based on your rule, I expect your redirect is going to:
/example.com/example.com/services-skills

Because your redirect rule does not use an absolute URL. This URL must redirect further in some kind of loop. To fix it, you will need to put the into your redirect rule:

Redirect 301 /example.com/services-skills.html example.com/services-skills

or take out the example.com (as long as you are using a newer version of Apache server (2.4 or later) which has only been out for about a year.

Redirect 301 /example.com/services-skills.html /services-skills


Rather than implementing separate rules for every page, it might be better to have a single rule that removes .html from every URL:

redirectMatch 301 ^(.*).html$

10% popularity Vote Up Vote Down


 

@Chiappetta492

You can signal start and end of string:

Redirect 301 ^/example.com/services-skills.html$ example.com/services-skills
Start of string--^ End of search string-----^

10% popularity Vote Up Vote Down


 

@Hamaas447

Are you sure that the URL in the wordpress dashboard > settings is correct? That is the most common cause of a redirect loop.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme