英文:
redirect page a in domain x to page b in domain y
问题
I know it may be duplicate in some cases but I couldn't find an exact answer for this.
I've changed my website url and I created all pages in new format, now I want to redirect old urls to new one, the urls are in persian format so this my old domain address:
old: https://sisnogroup.com/%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84%DB%8C-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%AF%D8%A7%D9%86%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%A7%D9%86
new: https://sisnogroup.ge/fa/%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86
I want to redirect it permanently to new one.
I did some code in webconfig/iisrewrite but it returns 404.
what is the exact web.config code to do this?
<rule name="Redirect to domain 2" stopProcessing="true">
<match url="^%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84%DB%8C-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%AF%D8%A7%D9%86%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%A7%D9%86$" />
<action type="Redirect" url="https://sisnogroup.ge/fa/%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86" redirectType="Permanent" />
</rule>
Update
this is the log from failed request tracing:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>10</Opcode>
<Keywords>0x400</Keywords>
<TimeCreated SystemTime="2023-06-23T08:45:41.197Z"/>
<Correlation ActivityID="{80009014-0000-9500-B63F-84710C7967BB}"/>
<Execution ProcessID="16364" ThreadID="13304"/>
<Computer>WIN-KF45KMECN9L</Computer>
</System>
<EventData>
<Data Name="ContextId">{80009014-0000-9500-B63F-84710C7967BB}</Data>
<Data Name="Pattern">^%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84%DB%8C-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%AF%D8%A7%D9%86%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%A7%D9%86$</Data>
<Data Name="Input">robots.txt</Data>
<Data Name="Negate">false</Data>
<Data Name="Matched">false</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PATTERN_MATCH</Opcode>
<Keywords>
<Keyword>Rewrite</Keyword>
</Keywords>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{0469ABFA-1BB2-466A-B645-E3E15A02F38B}</EventGuid>
</ExtendedTracingInfo>
</Event>
英文:
I know it may be duplicate in some cases but I couldn't find an exact answer for this.
I've changed my website url and I created all pages in new format, now I want to redirect old urls to new one, the urls are in persian format so this my old domain address:
old: https://sisnogroup.com/%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84%DB%8C-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%AF%D8%A7%D9%86%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%A7%D9%86
new: https://sisnogroup.ge/fa/%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86
I want to redirect it permenantly to new one.
I did some code in webconfig/iisrewrite but it returns 404.
what is the exact web.config code to do this?
<rule name="Redirect to domain 2" stopProcessing="true">
<match url="^%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84%DB%8C-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%AF%D8%A7%D9%86%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%A7%D9%86$" />
<action type="Redirect" url="https://sisnogroup.ge/fa/%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86" redirectType="Permanent" />
</rule>
Update
this is the log from failed request tracing:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>10</Opcode>
<Keywords>0x400</Keywords>
<TimeCreated SystemTime="2023-06-23T08:45:41.197Z"/>
<Correlation ActivityID="{80009014-0000-9500-B63F-84710C7967BB}"/>
<Execution ProcessID="16364" ThreadID="13304"/>
<Computer>WIN-KF45KMECN9L</Computer>
</System>
<EventData>
<Data Name="ContextId">{80009014-0000-9500-B63F-84710C7967BB}</Data>
<Data Name="Pattern">^%D8%A7%D9%82%D8%A7%D9%85%D8%AA-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84%DB%8C-%DA%AF%D8%B1%D8%AC%D8%B3%D8%AA%D8%A7%D9%86-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%AF%D8%A7%D9%86%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%A7%D9%86$</Data>
<Data Name="Input">robots.txt</Data>
<Data Name="Negate">false</Data>
<Data Name="Matched">false</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PATTERN_MATCH</Opcode>
<Keywords>
<Keyword>Rewrite</Keyword>
</Keywords>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{0469ABFA-1BB2-466A-B645-E3E15A02F38B}</EventGuid>
</ExtendedTracingInfo>
</Event>
答案1
得分: 0
我找到了问题,它涉及到URL中的波斯字符,在规则的模式部分,我复制并粘贴了波斯编码字符,所以它似乎与URL的确切值不同,例如,在模式部分,你应该使用类似以下的内容:
^بهترین-شرکت-خدمات-در-ایران&
而不是我在问题中提到的包含百分号的内容。希望对其他遇到相同问题的人有所帮助。
英文:
I found the problem, it was about Persian characters in URLs,
in the pattern section of the rule, I copied and past the Persian encoded character so it seems it's different from the exact value of the URL,
for example, in the pattern section, you should use something like:
^بهترین-شرکت-خدمات-در-ایران&
not something like that I mentioned in my question which contains % signs.
hope it helps other with the same problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论