0
我有一个htaccess让用户使用https并实现一些语义网址。 这就是:让htaccess重定向到https。*
Options -MultiViews
RewriteEngine On
RewriteCond %{HTTPS} off [NC]
RewriteRule ^https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule ^(index|getReadings|admin|adminNewDesign)\/([A-Za-z]*)$ https://%{HTTP_HOST}/$1.php?id=$2 [L,QSA,NC]
RewriteRule ^adminNewDesign$ https://%{HTTP_HOST}/adminNewDesign/addingOperators/i [L,QSA,NC]
RewriteRule ^admin$ https://%{HTTP_HOST}/admin.php [L,QSA,NC]
RewriteRule ^(index)/(reg)/(byphone|byemail)?$ https://%{HTTP_HOST}/$1.php?id=$2&loginform=$3 [L,QSA,NC]
RewriteRule ^(index|getReadings|admin|adminNewDesign)/(\w+)/(\d+)/?$ https://%{HTTP_HOST}/$1.php?id=$2&page=$3 [L,QSA,NC]
RewriteRule ^(index|getReadings)/(fullpage)/(true)/?$ https://%{HTTP_HOST}/$1/php?$2=$3 [L,QSA,NC]
RewriteRule ^(admin|adminNewDesign)\/([A-Za-z]*)/([A-Za-z]*)$ https://%{HTTP_HOST}/$1.php?id=$2&device=$3 [L,QSA,NC]
RewriteRule ^adminNewDesign\/(individualAnalogueNotification|analogueNotification|intercomNotification)/record-([0-9]+)\.wav$ https://%{HTTP_HOST}/play_audio.php?recordType=$1&record_id=$2 [L,QSA,NC]
它正常工作,例如,从指数/测试重定向到https://hostname.ru/index.php?id=test。 但是当我去adminNewDesign它重定向到https://hostname.ru/adminNewDesign/addingOperators/i
当我使用HTTP另一个规则在这里工作,这一个:
RewriteRule ^(admin|adminNewDesign)\/([A-Za-z]*)/([A-Za-z]*)$ https://%{HTTP_HOST}/$1.php?id=$2&device=$3 [L,QSA,NC]
但最后重定向现在无法正常工作,它给了404错误。 所以看起来像^(admin|adminNewDesign)\/([A-Za-z]*)/([A-Za-z]*)$
适合http://hostname.ru/admin但不适合https://hostname.ru/admin。 那么,我怎样才能显示htaccess重定向从https像urls?
奇怪,但这根本不起作用。 https://domainname.ru/getReadings/icom显示我404.我清除了我的Chrome浏览器缓存并以隐身模式打开它。 –
另外,从我以前的问题的人http://stackoverflow.com/questions/35747480/rewrite-htaccess-for-https 建议添加https://%{HTTP_HOST} /重定向。它效果更好。 –
'getReadings.php'位于何处?什么是'https'站点的'DocumentRoot'? – anubhava