Welcome to WebmasterWorld Guest from 34.236.171.181

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

build exception from https redirect without creating loop

     
8:08 pm on Mar 30, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


I need to take one page from this wordpress site: /singnup/ and stop it from re-directing to the https version (and if it is https redirect it to http). How would I alter the htaccess code to do this?
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


#----- START PRODUCT NAME REM -----
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*)
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$
RewriteRule (.*) /peoductname/client/website/productname client.php?productnameref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L]
#----- END PRODUCT NAME REM -----

</IfModule>
2:59 am on Mar 31, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


You should put any new rules BEFORE the WP envelope (the part beginning and ending in # comment lines). Save the WP envelope for things that were installed by WP itself (including verified mods, skins, plugins and so on). This, in turn, means that the single line
RewriteEngine on

also has to go before the envelope, since it has to come before any RewriteRules. (Your server will not explode if you end up saying it twice.) You do not need a RewriteBase for this part-- or indeed for any other part, but never mind that.

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Eeuw, what's that HTTP_HOST doing there? Targets of RewriteRules should always give an explicit hostname, unless you've got multiple sites sharing a single htaccess file. You also don't need the REQUEST_URI since you just got through capturing it. And, finally, replace R with R=301 or else it will default to 302.

That being said, you just need one more condition:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/signup/
RewriteRule (.*) https://www.example.com/$1 [R=301,L]

where "www.example.com" means the preferred form of your own domain name, with or without www.

And then a second ruleset that goes
RewriteCond %{HTTPS} on
RewriteRule ^signup/$ http://www.example.com/signup/ [R=301,L]

Note that since you're now matching a specific URL, it goes in the body of the rule; conditions are only for negative matches. No need to capture, since you already know what the text will be.
12:17 pm on Mar 31, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Thanks, (I omitted the hyphen from the url) so altogether it should read...?
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/sign[-]up/
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^signup/$ http://www.example.com/sign[-]up/ [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


#----- START PRODUCT NAME REM -----
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*)
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$
RewriteRule (.*) /peoductname/client/website/productname client.php?productnameref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L]
#----- END PRODUCT NAME REM -----

</IfModule>

[edited by: phranque at 6:41 pm (utc) on Mar 31, 2015]
[edit reason] unlinked URL [/edit]

7:07 pm on Mar 31, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


Looks right. Except:
sign[-]up

You can say this in a pattern (including conditions) because it then just means "any one member of the set whose only possible member is a hyphen". You can't say it in a target, because then it will mean "open-bracket, hyphen, close-bracket". If you just meant that the URL includes a hyphen which you forgot to type in (I could tell it was a type-in because your fingers misspelled "signup" ;)), that doesn't need to be escaped or bracketed. In fact hyphens are better off outside of brackets. (This is a Regular Expression thing, not specific to Apache or mod_rewrite.)
7:27 pm on Mar 31, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Thanks regular expressions still scare me.
7:36 pm on Mar 31, 2015 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11870
votes: 245


welcome to WebmasterWorld, data222!
7:14 pm on Apr 3, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts:19
votes: 0


When I switched to the new code, everything seems to work fine except one thing. The exempted page is blocked by Websense at the library I'm in now because they think it is a parked domain.
(Yes we have only been using the https version and redirecting all traffic from http to https up until now, but that doesn't mean we parked the domain.

Any ideas, is this an evil act on the part of the hosting company, or can I change the redirect method to avoid this perception, or do we need to contact all the filtering companies?
10:25 pm on Apr 3, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Please ignore last post. I had the url wrong for that page. When I use the right one with the above code, the exempted page just redirects to the homepage.
This is true both when using http and https in the address.
It happens in both cases even if I remove these 2 lines:
RewriteCond %{HTTPS} on
RewriteRule ^pick-an-ebook/$ http://example.net/pick-an-ebook/ [R=301,L]
4:17 am on Apr 4, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


When I use the right one with the above code, the exempted page just redirects to the homepage.

That sounds a little as if the rule itself has nothing wrong with it, but there's some later rule behaving contrary to intentions.

:: scroll up ::

Uh-oh, yup, you did say WordPress. Is this specific page a WP page or a real, physical page that has its own existence?
12:05 pm on Apr 4, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


It is a Wordpress page. The only wrinkle in it is that the url is http:example.net/pick-an-ebook and the title is Choose A Free Ebook.
I don't see anything after the section we discussed that changes things but here is the whole file with only the domain name changed:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/pick-an-ebook/
RewriteRule (.*) https://example.net/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^pick-an-ebook/$ http://example.net/pick-an-ebook/ [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


#----- START DAP -----
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*)
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$
RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L]
#----- END DAP -----

</IfModule>

# END WordPress

### HEADER CACHING
# /htaccess/speed-up-sites-with-htaccess-caching.html
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch "\.(js|css|pdf|swf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(html|htm|txt)$">
Header set Cache-Control "max-age=600"
</FilesMatch>
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>

## ALTERNATE EXPIRES CACHING
# htaccesselite.com/d/use-htaccess-to-speed-up-your-site-discussion-vt67.html
ExpiresActive On
ExpiresDefault A604800
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType text/html A300

<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
ExpiresActive Off
</FilesMatch>

[edited by: phranque at 4:15 am (utc) on Apr 5, 2015]
[edit reason] unlinked URL [/edit]

8:40 pm on Apr 4, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


Unless I'm overlooking something glaringly obvious, the problem is happening in WordPress.
This is true both when using http and https in the address.

Fire up Firefox with Live Headers enabled. (Pro tip: You can tell it to exclude certain requests. I normally tell it to omit images and stylesheets, so the result is less cluttered. If you've been upgrading lately, you may need to reinstall. I just did.) What you should see happening is:
If you request the /signup/ page with https, there will be a single redirect to /signup/ with http.
If you request the /signup/ page with http, you will go straight to the page.

Obviously there is extra stuff happening. So first let's see what that extra stuff is.

Also make sure your WP settings all say what they're supposed to say. You may need to click a few extra boxes if the site is mixed http and https. And, come to think of it, do you end up on http front page or https front page?
3:54 am on Apr 5, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


That page redirects to the home page https version. It is not a mixed site. Everything is https except I need to change that one page to http as our email company changed something on their site which broke my opt in form select list redirects and nothing else seems to fix it. I put the form on a different (http) site and it did work, so that is the story behind changing this one page. Below is the Live Header return:
https://example.net/pick-an-ebook/

GET /pick-an-ebook/ HTTP/1.1
Host: example.net
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://example.net/
Cookie: __utma=142812215.786699786.1428246488.1428246488.1428246488.1; __utmb=142812215.5.10.1428246488; __utmc=142812215; __utmz=142812215.1428246488.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt=1; PHPSESSID=mbcqae5uim8q7j5mpbppcfs0h4
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Sun, 05 Apr 2015 03:50:48 GMT
Server: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
Location: http://example.net/pick-an-ebook/
Cache-Control: max-age=300
Expires: Sun, 05 Apr 2015 03:55:48 GMT
Content-Length: 253
Connection: close
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
https://example.net/index.php

GET /index.php HTTP/1.1
Host: example.net
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: __utma=142812215.786699786.1428246488.1428246488.1428246488.1; __utmb=142812215.5.10.1428246488; __utmc=142812215; __utmz=142812215.1428246488.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt=1; PHPSESSID=mbcqae5uim8q7j5mpbppcfs0h4
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Sun, 05 Apr 2015 03:50:48 GMT
Server: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
X-Powered-By: PHP/5.3.29
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding,Cookie
X-Pingback: https://example.net/xmlrpc.php
Location: https://example.net/
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
https://example.net/

GET / HTTP/1.1
Host: example.net
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: __utma=142812215.786699786.1428246488.1428246488.1428246488.1; __utmb=142812215.5.10.1428246488; __utmc=142812215; __utmz=142812215.1428246488.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt=1; PHPSESSID=mbcqae5uim8q7j5mpbppcfs0h4
Connection: keep-alive

HTTP/1.1 200 OK
Date: Sun, 05 Apr 2015 03:50:50 GMT
Server: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
X-Powered-By: PHP/5.3.29
Vary: Accept-Encoding,Cookie
Cache-Control: max-age=3, must-revalidate
WP-Super-Cache: Served supercache file from PHP
Content-Encoding: gzip
Content-Length: 7588
Connection: close
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
https://ssl.google-analytics.com/ga.js

GET /ga.js HTTP/1.1
Host: ssl.google-analytics.com
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://example.net/
Connection: keep-alive
If-Modified-Since: Thu, 05 Feb 2015 17:35:24 GMT

HTTP/2.0 304 Not Modified
Age: 1214
Alternate-Protocol: 443:quic,p=0.5
Date: Sun, 05 Apr 2015 03:30:36 GMT
Expires: Sun, 05 Apr 2015 05:30:36 GMT
Server: GFE/2.0
X-Firefox-Spdy: h2-15
----------------------------------------------------------
https://ssl.google-analytics.com/__utm.gif?utmwv=5.6.3&utms=6&utmn=274685880&utmhn=example.net&utmcs=UTF-8&utmsr=1024x768&utmvp=605x582&utmsc=24-bit&utmul=en-us&utmje=0&utmfl=17.0%20r0&utmdt=Home%20%7C%20Affordable%20Online%20Distance%20Training%20Courses&utmhid=359033945&utmr=-&utmp=%2F&utmht=1428246874211&utmac=UA-0000000-0&utmcc=__utma%3D142812215.786699786.1428246488.1428246488.1428246488.1%3B%2B__utmz%3D142812215.1428246488.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmjid=&utmu=qAAAAAAAAAAAAAAAAAAAAAAE~

GET /__utm.gif?utmwv=5.6.3&utms=6&utmn=274685880&utmhn=example.net&utmcs=UTF-8&utmsr=1024x768&utmvp=605x582&utmsc=24-bit&utmul=en-us&utmje=0&utmfl=17.0%20r0&utmdt=Home%20%7C%20Affordable%20Online%20Distance%20Training%20Courses&utmhid=359033945&utmr=-&utmp=%2F&utmht=1428246874211&utmac=UA-0000000-0&utmcc=__utma%3D142812215.786699786.1428246488.1428246488.1428246488.1%3B%2B__utmz%3D142812215.1428246488.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmjid=&utmu=qAAAAAAAAAAAAAAAAAAAAAAE~ HTTP/1.1
Host: ssl.google-analytics.com
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://example.net/
Connection: keep-alive

HTTP/2.0 200 OK
Age: 130813
Alternate-Protocol: 443:quic,p=0.5
Cache-Control: private, no-cache, no-cache=Set-Cookie, proxy-revalidate
Content-Length: 35
Content-Type: image/gif
Date: Fri, 03 Apr 2015 15:30:37 GMT
Expires: Wed, 19 Apr 2000 11:43:00 GMT
Last-Modified: Wed, 21 Jan 2004 19:51:30 GMT
Pragma: no-cache
Server: Golfe2
x-content-type-options: nosniff
X-Firefox-Spdy: h2-15
----------------------------------------------------------

[edited by: phranque at 4:12 am (utc) on Apr 5, 2015]
[edit reason] unlinked URLs [/edit]

4:25 am on Apr 5, 2015 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11870
votes: 245


I don't understand how this sequence happened:
GET /pick-an-ebook/ HTTP/1.1
...

HTTP/1.1 301 Moved Permanently
...
Location: http://example.net/pick-an-ebook/
...
----------------------------------------------------------
https://example.net/index.php

GET /index.php HTTP/1.1

it seems like your browser did something on its own there.
1:46 pm on Apr 6, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


I was on the home page and I clicked on the menu for /pick-an-ebook/
(which is the real url of the exempted page).
It looks like the standard Wordpress section of .htaccess is redirecting it to index.php? This happens with any page that is used with the "exemption code"
Perhaps the Wordpress code needs to be before the exemption code instead of after?
4:08 pm on Apr 6, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


Perhaps the Wordpress code needs to be before the exemption code instead of after?

No, absolutely not. Your additional rules involve external redirects, while WP is about internal rewrites. But it still shouldn't be redirecting to the home page; that smacks of "soft 404".

Check your WP settings again. I think you have to say something extra when the site is mixed http and https (even a single page one or the other counts as "mixed")

:: looking around vaguely for not2easy, who speaks WordPress ::
2:47 pm on Apr 9, 2015 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4558
votes: 363


If the page is a WP page it will follow all WP settings/rules. The htaccess shown here is not the default, it has been edited manually and it can be overwritten automatically one day with a core WP update. That will be a surprise.

WP pages don't exist at an URL location, they are elements of a page stored in a database and put together on the fly as requested, so external rules are often defeated. (The rule executes before the URL is requested and the request is rewritten within WP) The default WP envelope should always be the last thing in your htaccess file and it should never be edited.

Rather than try to fix it in the .htaccess file, you can possibly fix it internally by having the page set to redirect to a different URL. (note: I have not ever tried to redirect https: to http: -so no guarantees) The only way I know to redirect a single page within WP is by using the Yoast SEO plugin to manage the meta data and headers of the page you want redirected.

I only have used the Yoast redirect once, but it worked beautifully on a page that had been created and indexed with a horribly misspelled word in the title. If that can't handle it, I would look for a specific plugin that probably exists for that purpose.

If all that fails, I would look into the possibility of using a page outside of WP to handle the function. A static URL can be redirected via htaccess.
2:55 pm on Apr 9, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Thx I'll try those solutions out.
5:20 pm on Apr 12, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


No luck on the redirects.I tried both Yoast and Safe-Redirect plugin with the present last htaccess code above.They both just end up at the home page.

I hate to go the html rout as then I lose the mobile re-sizing that is built into the WP theme.
8:11 pm on Apr 12, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


:: going back for a closer look at Live Headers result ::
GET /index.php HTTP/1.1
Whoa there. Something is seriously wrong. Yes, a CMS site is entirely built upon index.php -- but it would never, ever come through as an explicit GET request. It's done with behind-the-scenes rewriting; the browser should never even know the page exists.

The immediately preceding request gets a 301, which means this is not a mistake caused by accidentally including the full domain name in a target somewhere; that would default to a 302. (You'd also get a 302 if the ErrorDocument statement was misconfigured, so no need to look there either.)

:: looking back further ::

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/pick-an-ebook/
RewriteRule (.*) https://example.net/$1 [R=301,L]
Uh-oh, this doesn't exclude internal requests. If a request has been rewritten to index.php, and is sent back through the whole Apache system, it will meet this rule. And you will then get an unintended external redirect to index.php by name.

You need to expand the condition so it says:
RewriteCond %{REQUEST_URI} !/(pick-an-ebook|index\.php)
or, in the alternative, duplicate the line
RewriteRule ^index\.php - [L]
and put it at the very beginning of your RewriteRules. You have to duplicate it, rather than simply move it, because nothing inside your WP envelope (was it WP? whatever the ### CMS we're talking about) should be touched. Except I'd want to make a further exclusion involving %{THE_REQUEST} since nobody should be allowed to ask for "index.php" by name...

I'm getting a headache :(
8:32 pm on Apr 12, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Thx will try this out tomorrow. Looks like a lot of study required to be able to follow what you're saying.
3:55 pm on Apr 13, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Both of those last solutions yield this:
This webpage has a redirect loop
8:05 pm on Apr 13, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


Let's see the exact ruleset or rulesets that triggered the error. Is it a server error (500-class, originating with rules in L alone) or a redirect error (300-class, rules in R, error message from browser)?
8:31 pm on Apr 13, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


301 Message on Firefox states that the server is redirecting in a way that will never complete.
9:01 pm on Apr 13, 2015 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4558
votes: 363


Unless the default WP envelope was ever put back into the htaccess, you may have surprises. It is not the default as shown above, someone stuck a plugin rewrite inside of it.

This is the default:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


I would check with the DAP people to get their placement instructions for the plugin rules which should never be in the WP envelope. The part above is what can be overwritten on routine core updates and your plugin would fail.

The default WP envelope should be at the end. I don't see where the canonical and https redirects are being handled after the first question, they are not in the "Entire file" as shown. The http --> https: should be taken care of before the page level but it is sending first to index.php page (which would be WP) and then back to the root directory. Until the changes put in place are out here to follow through, we are guessing.
9:18 pm on Apr 13, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


We actually changed some of the code as DAP would not force downloads of protected pdfs the way we wanted. (I think it was in htaccess but could have been in the functions file-checcking on that).I'm not worried about overwrites. I keep a few backups around. Unfortunately the genius on fiverr who was able to alter the DAP code isn't available. We did not change the location of the plugin code though.
Sorry it looks like you are trying to tell me something and I'm not following the implications.
10:23 pm on Apr 13, 2015 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4558
votes: 363


This may be true, I apologize. I am trying to tell you that if you do not share the current state of the htaccess file, it is futile for people who want to help to try to guess what is happening, why, and what you might do to fix it.

At the beginning here, we could see the cause of some of the problems and based on that information, you have received some information and said you have made some changes, but now all we know is that whatever change(s) were made did not bring success. An update on the htacces would help people see why, where, what. Current state of headers is helpful as well.
11:16 pm on Apr 13, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 887


Clarification: We do not need to see your entire htaccess file! (I could say the same about many posts in HTML or CSS subforums.) Just the mod_rewrite part, complete, from beginning to end.

All this is assuming that you don't have any lurking mod_alias rules (Redirect or RedirectMatch by that name).

Message on Firefox states that the server is redirecting in a way that will never complete

OK, so the issue is external redirects. But with Live Headers you can see what you're requesting. Is it the identical URL over and over, or is something getting changed or added each time?

You're on shared hosting, right? So you don't have the option of running a RewriteLog to pinpoint exactly which rule is firing and what's triggering it.
6:47 pm on Apr 14, 2015 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11870
votes: 245


i agree with lucy24 and not2easy.
we need to see all of the RewriteCond and RewriteRule directives as they currently stand.
we also need to see the current HTTP Live Headers output so that we can see what the chained redirect is.
7:42 pm on Apr 14, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Here is the current code:
RewriteRule ^index\.php$ - [L]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/pick-an-ebook/
RewriteRule (.*) https://example.net/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^pick-an-ebook/$ http://example.net/pick-an-ebook [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


#----- START DAP -----
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*)
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$
RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L]
#----- END DAP -----

What I got was repeated 301 errors will post next

[edited by: phranque at 7:51 pm (utc) on Apr 14, 2015]
[edit reason] exemplified URLs [/edit]

7:47 pm on Apr 14, 2015 (gmt 0)

New User

joined:Mar 30, 2015
posts: 19
votes: 0


Here is live header, sorry 301 not repeating here:
https://example.net/pick-an-ebook

GET /pick-an-ebook HTTP/1.1
Host: example.net
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: __utma=142812215.326810114.1429041480.1429041480.1429041480.1; __utmb=142812215.1.10.1429041480; __utmc=142812215; __utmz=142812215.1429041480.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt=1; PHPSESSID=r56lfk5cg4pc5kq36tscake2o4
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Tue, 14 Apr 2015 19:58:44 GMT
Server: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
X-Powered-By: PHP/5.3.29
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding,Cookie
X-Pingback: https://example.net/xmlrpc.php
Location: https://example.net/pick-an-ebook/
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
------------

On page error message:
The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept cookies.

[edited by: phranque at 7:53 pm (utc) on Apr 14, 2015]
[edit reason] unlinked URLs [/edit]

This 33 message thread spans 2 pages: 33