Skip to content

Instantly share code, notes, and snippets.

@jayroh
Created March 26, 2011 21:52
Show Gist options
  • Save jayroh/888671 to your computer and use it in GitHub Desktop.
Save jayroh/888671 to your computer and use it in GitHub Desktop.
from dig-wp
# CANONICAL ROBOTS.TXT
<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{REQUEST_URI} !^/robots.txt$ [NC]
RewriteCond %{REQUEST_URI} robots\.txt [NC]
RewriteRule .* http://examplesite.com/robots.txt [R=301,L]
</IfModule>
# CANONICAL FAVICONS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/favicon.ico$ [NC]
RewriteCond %{REQUEST_URI} /favicon(s)?\.?(gif|ico|jpe?g?|png)?$ [NC]
RewriteRule (.*) http://examplesite.com/favicon.ico [R=301,L]
</IfModule>
# CANONICAL SITEMAPS
<IfModule mod_alias.c>
RedirectMatch 301 /sitemap\.xml$ http://examplesite.com/sitemap.xml
RedirectMatch 301 /sitemap\.xml\.gz$ http://examplesite.com/sitemap.xml.gz
</IfModule>
# CANONICAL URLs
<IfModule mod_alias.c>
RedirectMatch 301 ^/tag/$ http://examplesite.com/
RedirectMatch 301 ^/search/$ http://examplesite.com/
RedirectMatch 301 ^/category/$ http://examplesite.com/
</IfModule>
# CANONICAL FEEDS
<IfModule mod_alias.c>
RedirectMatch 301 /feed/(atom|rdf|rss|rss2)/?$ http://examplesite.com/feed/
RedirectMatch 301 /comments/feed/(atom|rdf|rss|rss2)/?$ http://examplesite.com/comments/feed/
</IfModule>
# REDIRECT to FEEDBURNER
# <IfModule mod_rewrite.c>
# RewriteCond %{REQUEST_URI} ^/feed/ [NC]
# RewriteCond %{HTTP_USER_AGENT} !(FeedBurner|FeedValidator) [NC]
# RewriteRule .* http://feeds.feedburner.com/mainContentFeed [L,R=302]
#
# RewriteCond %{REQUEST_URI} ^/comments/feed/ [NC]
# RewriteCond %{HTTP_USER_AGENT} !(FeedBurner|FeedValidator) [NC]
# RewriteRule .* http://feeds.feedburner.com/allCommentsFeed [L,R=302]
# </IfModule>
RedirectMatch 301 \@admin http://examplesite.com/wp-admin
RewriteRule ^login$ http://examplesite.com/wp-login.php [NC,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment