2014-10-17 3 views
-1

3 페이지를 리디렉션하려고하지만 어떤 이유로 작동하지 않습니다. 사이트가 ASP로 작성되었습니다asp htaccess 301 리디렉션

<IfModule mod_rewrite.c> 

    # Make sure directory listing is disabled 
    Options +FollowSymLinks -Indexes 
    RewriteEngine on 

    # Re-write for PDFs requests not pre-pended with /pdf/ I.E. in the root - prepend /pdf/ - Use negative look-ahead - If the file doesn't exist you get a 500 though sadly. 
    RewriteCond %{REQUEST_URI} ^/(?!pdf/)(.*)\.(pdf)$ 
    RewriteCond %{DOCUMENT_ROOT}/pdf/$1 -f 
    RewriteRule ^(.*)$ /pdf/$1 [L] 

    # If the URI is not in /images,/pdf,/css, or /js let the handler process it 
    RewriteCond %{REQUEST_URI} !^(/images/|/pdf/|/css/|/js/) 
    RewriteCond %{REQUEST_FILENAME} !handler.php 
    RewriteRule ^(.*)$ handler.php/$1 [L] 

    # If the URI IS in the above directories but the file doesn't exist run it through the handler as well 
    RewriteCond %{REQUEST_URI} ^(/images/|/pdf/|/css/|/js/) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ handler.php/$1 [L] 

    # Permanent URL redirect 
    Redirect 301 /Server_Rack_Cabinet_RS_42U.asp http://www.rackmountsolutions.net/cruxial-core-1000-series-server-rack.asp 
    Redirect 301 /Sound_Dampening_Proof_Server_Rack.asp http://www.rackmountsolutions.net/AcoustiQuiet_Soundproof_Server_Rack.asp 
    Redirect 301 /Relay_Rack_4_post.asp http://www.rackmountsolutions.net/4_Post_Server_Rack.asp 

</IfModule> 

# 영구 URL 리디렉션 부분이 작동하지 않는 것 같습니다. 위의 코드는 .htaccess 파일에있는 전체 코드입니다.

+0

'Redirect' 지시자는 mod_alias''에 의해 제공됩니다 – hjpotter92

답변

1

이 사이트는 IIS 서버에서 실행되기 때문에 web.config 파일이 어떻게 든 .htaccess 파일을 무효화합니다. 내가 어떻게했는지 보러. web.config 파일이 내 사이트의 루트 폴더에 있습니다. https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect :

<configuration> 
    <system.webServer> 
     <rewrite> 
    <rules> 

     <rule name="Env-leader-redirect1" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^Server_Rack_Cabinet_RS_42U.asp" /> 
     <conditions> 
      <add input="{HTTP_HOST}" pattern="^www\.rackmountsolutions\.net$" /> 
     </conditions> 
     <action type="Redirect" url="http://www.rackmountsolutions.net/cruxial-core-1000-series-server-rack.asp" /> 
    </rule> 

    <rule name="Env-leader-redirect2" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^Server_Rack_Cabinet_RS_42U.asp" /> 
     <conditions> 
      <add input="{HTTP_HOST}" pattern="^www\.rackmountsolutions\.net$" /> 
     </conditions> 
     <action type="Redirect" url="http://www.rackmountsolutions.net/cruxial-core-1000-series-server-rack.asp" /> 
    </rule> 

    </rules> 
    </rewrite> 
</system.webServer> 
</configuration>