7

Tôi đã thử:Làm thế nào để chuyển hướng đến gốc ứng dụng bằng cách sử dụng mô-đun Rewrite URL IIS7?

1) Tôi cố gắng chuỗi rỗng đầu tiên:

<action type="Redirect" url="" redirectType="Permanent" appendQueryString="false" /> 

Kết quả:

HTTP 500.52 - URL Rewrite Module Error. 
The substitution URL for the current action cannot be empty. 

2) Có lẽ tôi nên bỏ qua url thuộc tính:

<action type="Redirect" redirectType="Permanent" appendQueryString="false" /> 

Kết quả tương tự:

HTTP 500.52 - URL Rewrite Module Error. 
The substitution URL for the current action cannot be empty. 

3) Còn về cách ASP.NET:

<action type="Redirect" url="~" redirectType="Permanent" appendQueryString="false" /> 

cố gắng chuyển hướng đến {APP_ROOT}/~.

4) thử cuối:

<action type="Redirect" url="/" redirectType="Permanent" appendQueryString="false" /> 

Đúng như dự đoán, nó chuyển hướng vào thư mục gốc của máy chủ ...

Tôi muốn tìm thấy một số giải pháp chung sạch sẽ. (. Tôi không thể sử dụng một số bê tông /myCurrentAppPath)

Trả lời

5

này hoạt động tốt hơn:

<action type="Redirect" url="." redirectType="Permanent" appendQueryString="false" /> 
+0

+1 Ok. Cảm ơn bạn. –

2

Còn bây giờ cố gắng này, nó không phải sạch nhưng nó hoạt động:

<action type="Redirect" url="?" redirectType="Permanent" appendQueryString="false" /> 
+0

Cảm ơn bạn! Hãy cho tôi biết nếu bạn tìm thấy giải pháp tốt hơn :) –

Các vấn đề liên quan