Mobile app version of vmapp.org
Login or Join
Frith620

: Redirecting one page to HTTPS, and all others back to HTTP isn't working as expected 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

@Frith620

Posted in: #Apache2 #ModRewrite #RegularExpression

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:


User hits site over HTTP.
User clicks the order page and gets HTTPS URL. (No non-https URLs are loaded on that page, I've made sure of this.)
User clicks a non /order/ URL
The new URL is still HTTPS.
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/$ %{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_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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Frith620

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ravi8258870

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme