rewrite rule leads to infinite rewrite loop at apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gurus,

Just a silly question this is. But I really suffer it too much ...   :(

I'm using rewrite module to do rewrite url. I made below rule:

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST}   ^www.jco.com.cn$
RewriteCond %{REQUEST_URI} ^/myjco/mySecurity
RewriteRule (.*) https://www.jco.com.cn/myjco/mySecurity [L,R]

It works fine.  Any access to http://www.jco.com.cn/myjco/mySecurity will rewrite to https://www.jco.com.cn/myjco/mySecurity

But if I make below rule:

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST}   ^rm.jco.com.cn$
RewriteCond %{REQUEST_URI} ^/myjco/orders
RewriteRule (.*) https://rm.jco.com.cn/myjco/orders [L,R]

The browser returns error showing the apache is in an infinite rewrite loop. 
I turned on the rewrite module's log to 3 and I got below information:

---------------------------------------------------------------- log ---------------------------------
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (3) [perdir /jco/WebSite/] applying pattern '(.*)' to uri 'myjco/orders'
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (3) [perdir /jco/WebSite/] add path info postfix: /jco/WebSite/myjco -> /jco/WebSite/myjco/orders
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (3) [perdir /jco/WebSite/] strip per-dir prefix: /jco/WebSite/myjco/orders -> myjco/orders
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (3) [perdir /jco/WebSite/] applying pattern '(.*)' to uri 'myjco/orders'
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (2) [perdir /jco/WebSite/] rewrite 'myjco/orders' -> 'https://rm.jco.com.cn/myjco/orders'
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (2) [perdir /jco/WebSite/] explicitly forcing redirect with https://rm.jco.com.cn/myjco/orders
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (1) [perdir /jco/WebSite/] escaping https://rm.jco.com.cn/myjco/orders for redirect
10.22.11.49 - - [15/Jul/2015:23:35:20 +0800] [rm.jco.com.cn/sid#22d2f58][rid#23567f0/initial] (1) [perdir /jco/WebSite/] redirect to https://rm.jco.com.cn/myjco/orders [REDIRECT/302]



Really weird issue for me. Can you plz do me a favor?

Thanks,



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux