1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

htaccess - redirect loop showing in log, but what is it telling?

Discussion in 'Apache' started by richardwbb, Jul 4, 2017.

  1. #1
    I'm a little stuck with .htaccess, I have some .htaccess code and some redirecting isn't proper. But before I post some .htaccess code, I think it is better to post log output;

    [​IMG]
    Notice the "<snip>", it was way longer. I've read the forum rules, so I don't mess around with 4277 bytes of repeating Apache log ouput. Notice also, it is a picture shown. The forum software chewed on it, but since I run a forum of my own, I have understanding for this.

    It has a date stamp
    core:error
    pid of program
    (36)File name too long:
    client [not relevant, just a choice I made out of the Apache log]
    domain.tld shows // [I don't understand, maybe someone can tell me?]
    HTTP/1.1 to file,
    referer: [not relevant I find]

    And the hints;
    "domain.tld", is https

    http:// domain.tld works
    http:// www. domain .tld doesn't seem to work at all/ not sure here if it would work, browsers do make a difference I believe. Notice the spaces, here also the forum software tried to open the posted url.

    I hope someone can point me in the right direction.
     
    richardwbb, Jul 4, 2017 IP
  2. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #2
    Post your htaccess code.
     
    Last edited: Jul 4, 2017
    billzo, Jul 4, 2017 IP
  3. richardwbb

    richardwbb Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    RewriteEngine On
    RewriteBase /
    
    
    
    #[https://webmasters.stackexchange.com/questions/69756/wild-card-redirection-for-https-and-non-www-version]
    RewriteCond %{HTTP_HOST} ^domain\.tld$
    RewriteRule ^(.*)$ "https\:\/\/www\.domain\.tld\/$1" [R=301,L]
    
    
    
    #[https://stackoverflow.com/questions/4083221/how-to-redirect-all-http-requests-to-https/21798882#21798882]
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    Code (markup):
     
    richardwbb, Jul 8, 2017 IP
  4. richardwbb

    richardwbb Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    I really hope that someone can help me with this. I'm not expecting working code [but that would be great of course], but I am willing to do something about this myself, but Apache .htaccess just isn't easy and I really needed help from topic from stackoverflow and stackexchange. Please anyone, my topic has over three hundred sixty views now. A good hint or idea would be okay, then I can investigate.
     
    richardwbb, Jul 16, 2017 IP
  5. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #5
    I'm just getting read for bed now. I will be back tomorrow morning. :)
     
    billzo, Jul 16, 2017 IP
  6. richardwbb

    richardwbb Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    Not that I have been waiting for that, I pitty that this forum doesn't seem to send notifications of replies to a given topic. Or maybe I have overlooked.

    It seems like I have narrowed things down. For the repeated endless redirects [http 400], most of the visitors [with a reasonable configuration], don't seem to be bothered. And for a part, it seem to be bots and not visitors. And for this error, it was what I was getting, with "Otter Browser", which is kind of to the point with everything it does with the connection with the webserver behind the url given to it. And, since I prefer to keep my browsing history [for my regular browser], some browsers seem to be smartly configured, when this browser "knows", the given url [where I as user, omit the "http"], is a port 80 or 443 and of course, if the connection does have or doesn't have secure socket layer This "smart" browser seemed to me to only once "learn", [remember], what connection it had, thus, it won't fail easy [even when I tried this with my own .htaccess, and if only http headers where simple, but they aren't.

    Then, two out of more search enignes I've used, showed this redirect loop [thus preventing a visitor to see the webpage], and they seem to have outdated url's, while I believe my redirect switches to https and refuses http, by my configuration. Then, I retried this a day later, and the error wasn't there any longer. So far so good, but, I do keep this redirect error popping up, [in the log file of Apache], but now I learned that "Otter Browser" is able to fail consequently.

    But I didn't type the 'http' part, this browser does that by itself [which is understandable], but typing https before domain.tld, then it gives the website asked for. However, as far as I can understand, that just bypasses the whole htaccess thing. And visitors just don't type https before www domain.tld and I even just type domain.tld.

    Now, when I type domain.tld [without www], it shows the webpage.

    I really do hope someone can help me a little, because, I just don't get it why browsers behave different for something like the difference between http and https [on the other hand, the htaccess I have now instructs Apache on how to give headers to a browser a visitor is using]. Lastly, maybe I'm even overlooking where the redirect I believe I hade from domain.tld to www domain.tld, [that now doesn't even seem to want to appear].
     
    richardwbb, Jul 19, 2017 IP