PDA

View Full Version : سوال: redirect کردن آدرسهایی که در آنها از index.php استفاده شده در IIS



BORHAN TEC
دوشنبه 20 مرداد 1393, 15:46 عصر
با عرض سلام خدمت دوستان گرامی،
وبسایتی داریم که قبلاً URL صفحات آن شامل index.php بود ولی بخاطر تعویض سرور و بهتر شدن SEO عبارت index.php را از صفحات حذف کردیم. به عنوان مثال این آدرس:

http://www.saghiyekosar.ir/index.php/ravanshenasi/5-koodak
به آدرس زیر تغییر پیدا کرد:

http://www.saghiyekosar.ir/ravanshenasi/5-koodak
الان همه چیز درست کار می کند ولی مشکل در انجاست که لینکهایی که به سایت ما شده بود همگی شکسته است. بنابراین می خواهم در صورتی که کاربر از همان آدرسهای قدیمی استفاده کرد با حذف index.php از URL به آدرس های جدید Redirect شویم. به عنوان مثال در صورتی که کاربر از این آدرس استفاده کرد:

http://www.saghiyekosar.ir/index.php/ravanshenasi/5-koodak
به این آدرس لینک شویم:

http://www.saghiyekosar.ir/ravanshenasi/5-koodak
با کمی تحقیق متوجه شدم که مشکل از فایل web.config است. این فایل در حال حاضر به این صورت است:

<?xml version="1.0" encoding="UTF-8"?><configuration>
<system.webServer>
<directoryBrowse enabled="true" />

<rewrite>
<rules>
<clear />


<rule name="Common Exploit Blocking" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" />
<add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" />
<add input="{QUERY_STRING}" pattern="(\&lt;|%3C).*script.*(\>|%3E)" />
<add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" />
<add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" />
</conditions>
<action type="Redirect" url="index.php" appendQueryString="false" redirectType="SeeOther" />
</rule>
<rule name="Joomla Search Rule" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="^/search.php" ignoreCase="true" />
</conditions>
<action type="Rewrite" url="/index.php?option=com_content&amp;view=article&amp;id=4" />
</rule>
<rule name="Joomla Main Rewrite Rule" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="(/[^.]*|\.(php|html?|feed|pdf|raw))$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<caching>
<profiles>
<add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" />
</profiles>
</caching>
<defaultDocument>
<files>
<clear />
<add value="Default.htm" />
<add value="default.html" />
<add value="Default.asp" />
<add value="default.aspx" />
<add value="default.php" />
<add value="default.pl" />
<add value="default.cgi" />
<add value="index.htm" />
<add value="index.html" />
<add value="index.php" />
<add value="index.asp" />
<add value="index.aspx" />
<add value="index.pl" />
<add value="index.cgi" />
<add value="iisstart.htm" />
<add value="holding.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>



از دوستان کسی میدونه که چطور این مشکل حل میشه؟

با تشکر...