2012-10-01 4 views
1

htaccess를 IIS 서버용 web.config로 변환하는 데 도움이 필요합니다.
이 htaccess로는 Modx 진화 1.x에서에 의해 사용되는Modx Evolution URL 재 작성 Web.Config IIS

#php_flag register_globals Off 
#AddDefaultCharset utf-8 
#php_value date.timezone Europe/Moscow 

Options +FollowSymlinks 
RewriteEngine on 
RewriteBase/

# Fix Apache internal dummy connections from breaking [(site_url)] cache 
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC] 
RewriteRule .* - [F,L] 

# Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin 
#RewriteCond %{HTTP_HOST} . 
#RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] 
#RewriteRule (.*) http://www.example.com/$1 [R=301,L] 

# Exclude /assets and /manager directories and images from rewrite rules 
RewriteRule ^(manager|assets)/*$ - [L] 
RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L] 

# For Friendly URLs 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 

나는 IIS 서버의 Web.config에이 구성을 변환해야합니다.

답변

1

, 웹 서버의 루트 폴더에 의 Web.config으로 이것을 넣어 도메인 이름으로 example.com을 변경

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <directoryBrowse enabled="false" /> 
     <defaultDocument> 
      <files> 
       <clear /> 
       <add value="index.php" /> 
       <add value="Default.htm" /> 
       <add value="Default.asp" /> 
       <add value="index.htm" /> 
       <add value="Default.aspx" /> 
      </files>  
     </defaultDocument> 
     <rewrite> 
      <rules> 
       <rule name="Add WWW prefix" > 
        <match url="(.*)" ignoreCase="true" /> 
        <conditions> 
         <add input="{HTTP_HOST}" pattern="^example\.com" /> 
        </conditions> 
        <action type="Redirect" url="http://www.example.com/{R:1}" 
        redirectType="Permanent" /> 
       </rule> 

       <rule name="ModX IIS7 Rule 1" stopProcessing="true"> 
        <match url=".*" ignoreCase="false" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{HTTP_USER_AGENT}" pattern="^.*internal\ dummy\ connection.*$" /> 
        </conditions> 
        <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> 
       </rule> 
       <rule name="ModX IIS7 Rule 2" stopProcessing="true"> 
        <match url="^(manager|assets)" ignoreCase="false" /> 
        <action type="None" /> 
       </rule>    
       <rule name="ModX IIS7 Rule 3" stopProcessing="true"> 
        <match url="^(.*)$" ignoreCase="false" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" /> 
        </conditions> 
        <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" /> 
       </rule> 
      </rules> 
     </rewrite>   
    </system.webServer> 
</configuration>