Last active
August 29, 2015 13:57
-
-
Save eduncan911/9864466 to your computer and use it in GitHub Desktop.
web.config configuration for redirects for MyBB w/Google SEO plugin on IIS 8 and Windows Azure Web Sites
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
version 1.0 | |
to use, make sure to change the following: | |
1) replace "www.MyDomain.com/forum/" with the actual url of your site. Such | |
as "www.acmecorp.com/" or "www.acmecorp.com/forum/". | |
2) if you change the urls here, make sure they match your Google SEO Url | |
settings exactly. | |
3) place this web.config in the root directory of your forums. if your root | |
directory is /forum/, then place it there. if it is at the root of your | |
domain, such as www.acmecorp.com/, then place it there. | |
Known issues: | |
* this does not capture /forum/index.php to rewrite to just "/forum/". | |
technically, Google will see two pages as your homepage: one with | |
/forum/index.php, and one without it. this can cause a penalty | |
in Google rankings. i'll tweak it when I get a chance. | |
--> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<!-- | |
change this to the exact url you want. for example, below we enforce | |
the "www" prefix for all urls. if there is no "www", it will redirect | |
to have "www" prefixed. | |
you can remove this if you want. it just forces the www. | |
--> | |
<rule name="CanonicalHostNameRule1"> | |
<match url="(.*)" /> | |
<conditions> | |
<add input="{HTTP_HOST}" pattern="^www\.MyDomain\.com$" negate="true" /> | |
</conditions> | |
<action type="Redirect" url="http://www.MyDomain.com/{R:1}" /> | |
</rule> | |
<!-- these rules below are the normal imported ones --> | |
<rule name="Imported Rule 1" stopProcessing="true"> | |
<match url="^([^&]*)&(.*)$" ignoreCase="false" /> | |
<action type="Redirect" url="http://www.MyDomain.com/forum/{R:1}?{R:2}" appendQueryString="true" redirectType="Permanent" /> | |
</rule> | |
<rule name="Imported Rule 2" stopProcessing="true"> | |
<match url="^sitemap-([^./]+)\.xml$" /> | |
<action type="Rewrite" url="misc.php?google_seo_sitemap={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 3" stopProcessing="true"> | |
<match url="^Forum-([^./]+)$" /> | |
<action type="Rewrite" url="forumdisplay.php?google_seo_forum={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 4" stopProcessing="true"> | |
<match url="^Thread-([^./]+)$" /> | |
<action type="Rewrite" url="showthread.php?google_seo_thread={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 5" stopProcessing="true"> | |
<match url="^Announcement-([^./]+)$" /> | |
<action type="Rewrite" url="announcements.php?google_seo_announcement={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 6" stopProcessing="true"> | |
<match url="^User-([^./]+)$" /> | |
<action type="Rewrite" url="member.php?action=profile&google_seo_user={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 7" stopProcessing="true"> | |
<match url="^Calendar-([^./]+)$" /> | |
<action type="Rewrite" url="calendar.php?google_seo_calendar={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 8" stopProcessing="true"> | |
<match url="^Event-([^./]+)$" /> | |
<action type="Rewrite" url="calendar.php?action=event&google_seo_event={R:1}" appendQueryString="true" /> | |
</rule> | |
<!-- These rules below are for the built-in MyBB Friendly Urls feature. --> | |
<rule name="Imported Rule 9" stopProcessing="true"> | |
<match url="^forum-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="forumdisplay.php?fid={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 10" stopProcessing="true"> | |
<match url="^forum-([0-9]+)-page-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="forumdisplay.php?fid={R:1}&page={R:2}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 11" stopProcessing="true"> | |
<match url="^thread-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 12" stopProcessing="true"> | |
<match url="^thread-([0-9]+)-page-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}&page={R:2}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 13" stopProcessing="true"> | |
<match url="^thread-([0-9]+)-lastpost\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}&action=lastpost" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 14" stopProcessing="true"> | |
<match url="^thread-([0-9]+)-nextnewest\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}&action=nextnewest" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 15" stopProcessing="true"> | |
<match url="^thread-([0-9]+)-nextoldest\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}&action=nextoldest" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 16" stopProcessing="true"> | |
<match url="^thread-([0-9]+)-newpost\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}&action=newpost" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 17" stopProcessing="true"> | |
<match url="^thread-([0-9]+)-post-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?tid={R:1}&pid={R:2}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 18" stopProcessing="true"> | |
<match url="^post-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="showthread.php?pid={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 19" stopProcessing="true"> | |
<match url="^announcement-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="announcements.php?aid={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 20" stopProcessing="true"> | |
<match url="^user-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="member.php?action=profile&uid={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 21" stopProcessing="true"> | |
<match url="^calendar-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="calendar.php?calendar={R:1}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 22" stopProcessing="true"> | |
<match url="^calendar-([0-9]+)-year-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="calendar.php?action=yearview&calendar={R:1}&year={R:2}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 23" stopProcessing="true"> | |
<match url="^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="calendar.php?calendar={R:1}&year={R:2}&month={R:3}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 24" stopProcessing="true"> | |
<match url="^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="calendar.php?action=dayview&calendar={R:1}&year={R:2}&month={R:3}&day={R:4}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 25" stopProcessing="true"> | |
<match url="^calendar-([0-9]+)-week-(n?[0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="calendar.php?action=weekview&calendar={R:1}&week={R:2}" appendQueryString="true" /> | |
</rule> | |
<rule name="Imported Rule 26" stopProcessing="true"> | |
<match url="^event-([0-9]+)\.html$" ignoreCase="false" /> | |
<action type="Rewrite" url="calendar.php?action=event&eid={R:1}" appendQueryString="true" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I only have 1 outstanding issue and that is capturing /forum/index.php and redirecting it to just /forum/. I haven't gotten around to that yet. I'll wait until Google complains about the duplicate url issue - if it detects it.