所以,我正在帮助一个人将所有HTTP请求重定向到HTTPS,但在.htaccess中添加任何这些请求时仍然会出现循环错误。
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\\Utility\\BrowserDrivers\\chromedriver.exe')
driver.get("https://finance.yahoo.com/")
wait = WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.NAME, "bankrate-overnight-average")))
items = driver.find_element_by_css_selector("table.tbl tbody")
list_of_data = [[item.text for item in data.find_elements_by_css_selector('td')]
for data in items.find_elements_by_css_selector('tr')]
for tab_data in list_of_data:
print(tab_data)
这是一个共享主机(如果这甚至很重要)。这是phpinfo文件,我不太清楚如何通过.htaccess使用这个this guy suggested
[]
['30 yr fixed', '3.82%', '', '3.80%']
['15 yr fixed', '3.01%', '', '3.05%']
['30 yr fixed refi', '3.80%', '', '3.77%']
['15 yr fixed refi', '2.97%', '', '3.02%']
['30 yr jumbo', '4.04%', '', '4.06%']
['5/1 ARM refi', '3.25%', '', '3.23%']
答案 0 :(得分:1)
在.htaccess
试试这个:
<IfModule mod_rewrite.c>
RewriteEngine On
# This will enable the Rewrite capabilities
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e. http://www.example.com/foo/ to https://www.example.com/foo/
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context
</IfModule>
也在/config.php
// HTTP
define('HTTP_SERVER', 'https://www.supawhip.com.au/');
// HTTPS
define('HTTPS_SERVER', 'https://www.supawhip.com.au/');
并在/admin/config.php
// HTTP
define('HTTP_SERVER', 'https://www.supawhip.com.au/admin/');
define('HTTP_CATALOG', 'https://www.supawhip.com.au/');
// HTTPS
define('HTTPS_SERVER', 'https://www.supawhip.com.au/admin/');
define('HTTPS_CATALOG', 'https://www.supawhip.com.au/');