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