0

I have a website built in dot net 4.0 using CMS (sitefinity4.0). This site is hosted on IIS6.0 I was trying URL Canonicalization where i need mysite.com/innerpages.aspx to redirect www.mysite.com/innerpages.aspx When I do a 302 redirection for mysite.com it works fine and the pages get redirected to www.mysite.com/innerpage.aspx but when i attempt to do 301 redirects the its shows 404 error for eurl.axd/.

The same setup on staging(with same app and IIS setting) works fine for 301 and 302 redirects.

While looking for solution I come across articles suggesting to disable ASP.NET v4.0 Extensionless URL feature on IIS 6.0 - Default.aspx page won't load on IIS 6

But I have checked the setting on staging and found that it is not disabled on staging. hence I am not sure if this will work.

Please help.

4

1 回答 1

0

我不确定您所说的“但是我已经检查了暂存设置,发现它在暂存时没有被禁用。” 如果它没有被禁用,那么您将获得无扩展名 URL。基本上发生的情况是,在重定向过程中,该过程没有意识到“eurl.axd/GUID”上的内部添加不是实际 URL 的一部分,因此它被保留(而不是被剥离)。现在,如果您故意尝试在您的网站上使用无扩展名 URL 和重定向,那么希望其他人可以在这里提供帮助。

但是,如果您不使用无扩展 URL,则需要禁用它。您可以通过更改注册表项来做到这一点:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\EnableExtensionlessUrls = 0

并且您必须在更改该注册表项后重新启动 IIS。如果您没有该注册表项,则 IIS 将其视为“开启”(EnableExtensionlessUrls = 1)。因此,您必须明确添加它才能摆脱它。

注意:如果您运行的是 64 位,则您要查找的注册表项位于不同的位置:

HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\ASP.NET\v4.0.30319.0\EnableExtensionlessUrls = 0

于 2012-07-07T01:32:54.493 回答