Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have WordPress 3.5.1 installed on Ubuntu 12.04 LTS. I'm running Apache 2.2.22.

NOTE: I can't share the domain that I'm working on, and must santize any config files. While the website is public, any problems I'm working on in connection to the client cannot be public.

The domain has two vhosts, one for HTTP and one for HTTPS, and both share the same document root. I have rewrite rules in the <directory> directive for each vhost rather than in an .hataccess file (just a preference, but the same behavior is seen when using an .htaccess file).

I want all access to the /order/ page to be over HTTPS. I want all other URLs to be only delivered over HTTP. Why? Because the site is littered with social media buttons and external libraries, some of which are not over HTTPS. Here's where things break down:

  1. User hits site over HTTP.
  2. User clicks the order page and gets HTTPS URL. (No non-https URLs are loaded on that page, I've made sure of this.)
  3. User clicks a non /order/ URL
  4. The new URL is still HTTPS.
  5. Browser security warnings pop up all over concerning the loading of "insecure" content on a secure site.

So far, I have the HTTP vhost configured to redirect people to the HTTPS order page:

    <Directory /var/www/mysite.com/htdocs>
            # Rewrite Rules
            RewriteEngine On

            # Rewrite access to order page over to HTTPS
            RewriteCond %{HTTPS} =off
            RewriteRule ^order/$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

            # Wordpress Magicks Below                
            RewriteRule ^index\.php$ - [L]

            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /index.php [L]
    </Directory>

When the above HTTP vhost's directive is in place, things work great, except for all subsequent browsing after accessing the /order/ page being HTTPS (insecure warnings everywhere!).

However, things fail when I try to write non /order/ links from HTTPS to HTTP. In the SSL enabled vhost's <Directory> directive, I have the following rule set:

    # SSL vhost:
    <Directory /var/www/mysite.com/htdocs>
            # Rewrite Rules
            RewriteEngine On

            # Remove HTTPS from non /order/ URLs
            RewriteCond %{HTTPS} =on
            RewriteCond %{REQUEST_URI} !^order/$
            RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

            # Wordpress Magicks Below
            RewriteRule ^index\.php$ - [L]

            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /index.php [L]
    </Directory>

However, any access to the /order/ page itself, wether HTTP or HTTPS, results in a redirect loop. Encouragingly, incoming links over HTTPS to non /order/ pages get redirected to their http:// equivalents, which is good!

I'm still in larval stage with mod_rewrite logic, but can't seem to spot the error in my attempts. Can anyone help spot what I'm doing wrong?

EDIT: Added some log files

I turned on RewriteLogLevel 9 for both vhosts and this is what I see under different circumstances.

Incoming HTTPS URL to a non /order/ page works great as per the RewriteLog for the SSL vhost:

68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri ''
68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite '' -> 'http://mysite.com/'
68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/
68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/ for redirect
68.231.66.6 - - [06/Jun/2013:15:02:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213c0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/ [REDIRECT/301]

From HTTP source URL on the site to the /order/ page does not work, causing a redirect loop - as per the RewriteLog for the HTTP vhost (and then following that is the RewriteLog for the SSL vhost):

68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '^order/$' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='off' pattern='=off' => matched
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'https://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with https://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping https://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:08:51 --0700] [mysite.com/sid#7f67ac3fdf40][rid#7f67b213c0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to https://mysite.com/order/ [REDIRECT/301]

SSL vhost shows massive loopage:

68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21420a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b21460a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:34 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213a0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] add path info postfix: /var/www/mysite.com/htdocs/order -> /var/www/mysite.com/htdocs/order/
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] strip per-dir prefix: /var/www/mysite.com/htdocs/order/ -> order/
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (3) [perdir /var/www/mysite.com/htdocs/] applying pattern '.*' to uri 'order/'
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='on' pattern='=on' => matched
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (4) [perdir /var/www/mysite.com/htdocs/] RewriteCond: input='/order/' pattern='!^order' => matched
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] rewrite 'order/' -> 'http://mysite.com/order/'
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (2) [perdir /var/www/mysite.com/htdocs/] explicitly forcing redirect with http://mysite.com/order/
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] escaping http://mysite.com/order/ for redirect
68.231.66.6 - - [06/Jun/2013:15:11:35 --0700] [mysite.com/sid#7f67ac3e5020][rid#7f67b213e0a0/initial] (1) [perdir /var/www/mysite.com/htdocs/] redirect to http://mysite.com/order/ [REDIRECT/301]

That's a lot of information, and I'm parsing through it, but as of now I'm not skillful enough to catch the error in my logic.

share|improve this question
    
You probably want to turn on rewrite logging and examine what's happening. For recent versions of Apache (2.4+) this has changed, see the mod_rewrite documentation. –  rossnz Jun 6 '13 at 22:09
    
@rossnz Okay, done! –  Wesley Jun 6 '13 at 22:24
1  
I think you're missing the initial / on the order path, so it should be RewriteCond %{REQUEST_URI} !^/order/$ –  Tim Fountain Jun 6 '13 at 23:04
    
@TimFountain Wow, you beat my by seven seconds! If you put that as the answer, I'll accept it. That's what it was. –  Wesley Jun 6 '13 at 23:05
add comment

1 Answer

up vote 2 down vote accepted

So just to expand on my comment, the request path appears to be missing the initial /, so it should be:

RewriteCond %{REQUEST_URI} !^/order/$

the clue was this line from your rewrite log:

RewriteCond: input='/order/' pattern='!^order' => matched

as you want that not to match for your rules to work.

It's quite common for mod_rewrite rules to include a RewriteBase / right at the start (in which case the / wouldn't be required on your pattern), so it's easy to miss this sort of thing if you're copying from another example.

share|improve this answer
    
That was it. I saw the pattern problem just as you commented. –  Wesley Jun 6 '13 at 23:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.