0

1&1에 Windows 서버에 내 웹 사이트를 호스팅했습니다. web.config에 요소를 추가 할 수 없습니다. <rewrite><rules> ... .htaccess 파일을 사용 중입니다 ... 저는 전문가가 아니므로 Apache 서버에서만 작동 할 것으로 예상됩니다. 내가 틀렸어! 내 .hataccess은 IIS에서도 작동합니다. 여기에 코드IIS에서 301을 사용하여 www가 아닌 ​​URL로 리디렉션

:

//Rewrite to www 
RewriteEngine On 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [R=301,L] 

//Prevent viewing of .htaccess file 
<Files .htaccess> 
order allow,deny 
deny from all 
</Files> 

리디렉션이 302 나는 301 리디렉션을 원하는 사용하여 수행됩니다 문제. 내가 피들러를 사용하고 이것은 결과입니다

enter image description here

나는 문제가 www.renovahaus.it 입니다이 웹 사이트는 어떻게 내 문제를 해결할 수 있습니까?

고맙습니다

답변

0

이것은 일반적으로 당신이 .htaccess 파일을 사용할 때 그러나 htaccess로의 내용은 아직 번역의 Web.config에서 비활성화되어 1 & 1이의 경우, URLRewrite 모듈로 이루어집니다 기본 web.config.

당신은 변환 프로세스 here

에 좋은 자습서를 읽을 수 있지만 요약하면 아마 코드 블록을 찾고 있습니다 : -

RewriteCond %{HTTP_HOST} ^example\.com$ [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 

투명하게 웹에 다음을 추가해야한다. 구성 파일 (직접 편집 할 수는 없지만)

<rewrite> 
    <rules> 
    <rule name="Imported Rule 1" stopProcessing="true"> 
     <match url="^(.*)$" ignoreCase="false" /> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="^example\.com$" /> 
     </conditions> 
     <action type="Redirect" redirectType="Permanent" url="http://www.example.com/{R:1}" /> 
    </rule> 
    <rule name="Imported Rule 2" stopProcessing="true"> 
     <match url="^(.*)$" ignoreCase="false" /> 
     <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
     <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" /> 
     </conditions> 
     <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" /> 
    </rule> 
    </rules> 
</rewrite> 
+0

왜 .htaccess 파일은 302를 사용하고 301은 아닌 리디렉션을 사용합니까? – Ciccio