我想将我的外联网网站重定向到 https 我有以下 web.config 规则:
<location path="." inheritInChildApplications="false">
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" `enter code here`ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}"
redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
问题来了,因为我的服务器上托管了几个孩子的服务,我不希望他们重定向,我只是想重定向网站而不是服务。
答案 0 :(得分:0)
执行此操作的一种方法是默认情况下重定向到HTTPS,但指定的文件夹列表除外。在以下示例中,文件夹import pandas
import os
# create a dummy file to test
with open('bigread.csv', 'w') as f:
for i in range(42):
f.write('{0}-col1 \t{0}-col2\t{0}-col3\n'.format(i))
if os.path.exists('bigwrite.csv'):
os.remove('bigwrite.csv')
class ChunkReader:
"""A file-like object for pandas csv readers that limits reads to a
given number of rows. Call `next_chunk` to reset the counter and
read the next chunk of rows into a new dataframe.
"""
def __init__(self, seq, count):
"""Read some sequence, count lines at a time"""
self.seq = seq
self.count = count
self.cur_count = 0
self.eof = 0
def read(self, n=0):
"""Read next row, until chunk size is exhausted"""
self.cur_count -= 1
if self.cur_count < 0:
return ''
try:
return next(self.seq)
except StopIteration:
self.eof = 1
return ''
def next_chunk(self):
"""Reset chunk counter for next series of reads"""
self.cur_count = self.count
return self.eof
# read/write in chunks
with open('bigread.csv', 'rb') as rd, open('bigwrite.csv', 'w') as wr:
reader = ChunkReader(rd, 10)
while not reader.eof:
reader.next_chunk()
# read dataframe, stripping unwanted col 2 as we go
df = pandas.read_table(reader, header=None, usecols=[0,1], engine='c')
df.to_csv(wr, sep='\t', header=False, index=False)
和/service1/
将从重定向中排除。其他一切都归于HTTPS。
/service2/