# Site has permanently moved to new domain
# domain.com to domain2.com
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]
# Page has moved temporarily
# domain.com/page.html to domain.com/new_page.html
RewriteRule ^page.html$ new_page.html [R,NC,L]
# Nice looking URLs (no query string)
# domain.com/category-name-1/ to domain.com/categories.php?name=category-name-1
RewriteRule ^([A-Za-z0-9-]+)/?$ categories.php?name=$1 [L]
# Nice looking URLs (no query string) with pagination
# domain.com/articles/title/5 to domain.com/article.php?name=title&page=5
RewriteRule ^articles/([A-Za-z0-9-]+)/([0-9]+)/?$
article.php?name=$1&page=$2 [L]
# Block referrer spam
RewriteCond %{HTTP_REFERRER} (weight) [NC,OR]
RewriteCond %{HTTP_REFERRER} (drugs) [NC]
RewriteRule .* - [F]
http://borkweb.com/story/apache-rewrite-cheatsheet
No comments:
Post a Comment