Hello and welcome to our community! Is this your first visit?
Register
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
    Location
    Cowboy Nation
    Posts
    2,190
    Thanks
    175
    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?

    Code:
    <VirtualHost *:80>
    ServerName tmgwebtech.com
    RedirectMatch permanent ^/(.*) http://www.tmgwebtech.com/$1
    </VirtualHost>
    
    <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
        </Directory>
    
    </VirtualHost>

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,556
    Thanks
    6
    Thanked 1,245 Times in 1,215 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
    Regular Coder benanamen's Avatar
    Join Date
    Oct 2015
    Posts
    912
    Thanks
    2
    Thanked 92 Times in 89 Posts
    OP, What is the situation you have that you are redirecting from?

    Examples:

    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.

  4. #4
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    1,638
    Thanks
    2
    Thanked 233 Times in 223 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:

    Code:
    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.
    http://www.cutcodedown.com


 

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
  •