Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Cowboy Nation
    Thanked 257 Times in 257 Posts

    Common too many redirects issue on .conf code

    Seeming to have an issue with too many redirects. I have done all of the common troubleshooting issues, clear cookies and what not. I have used this code multiple times but now it seems to throw the multiple redirects.

    This is on a wordpress site, however I have made all changes suggested to me. the home and site url were changed.

    Can anyone see an issue just looking at the code?

    <VirtualHost *:80>
    ServerName tmgwebtech.com
    RedirectMatch permanent ^/(.*) http://www.tmgwebtech.com/$1
    <VirtualHost *:80>
        ServerAdmin "email@email.com"
        ServerName  www.tmgwebtech.com
        MIMEMagicFile /dev/null
        CustomLog logs/www_tmgwebtech_access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
        ErrorLog logs/www_tmgwebtech_error_log
    	DocumentRoot "/home/sites/tmgtechnology"
        <Directory "/home/sites/tmgtechnology">
            Options +Indexes +FollowSymLinks
            Order allow,deny
            Allow from all
            AllowOverride All

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Halle (Saale), Germany
    Thanked 1,314 Times in 1,284 Posts
    Hey JC, long time no see.
    Well, I’m not overly proficient with Apache but I’m thinking the RedirectMatch rule is the culprit. Why do you need to redirect on the same server? What happens if you leave that out?

  3. #3
    Senior Coder benanamen's Avatar
    Join Date
    Oct 2015
    Thanked 139 Times in 134 Posts
    OP, What is the situation you have that you are redirecting from?


    I want all non www requests to my domain to go to www.mydomain or vice versa

    I moved/renamed/deleted a directory and want all requests for that to to go to blah blah...
    To save time, lets just assume I am almost never wrong.

    The XY Problem
    The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

    "This text has been encoded with ROT26. If you can read this you must have found a backdoor. Congratulations!"

  4. #4
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Keene, NH
    Thanked 384 Times in 374 Posts
    First off, the outer <> is always a conditional (like an if statement), so you've got the same condition twice in a row... there's no reason to do that.

    Second, this:

    RedirectMatch permanent ^/(.*) http://www.tmgwebtech.com/$1
    If that exists ON that domain it will go into a perpetual loop as your first condition is ALWAYS true; it will just sit there redirecting to itself until the timeout fires.
    I would rather have questions that can't be answered, than answers that can't be questioned.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts