useful .htaccess rewrites

# Site has permanently moved to new domain # domain1.com to domain2.com RewriteCond %{HTTP_HOST} ^www.domain1.com$ [NC] RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L] # Page has moved temporarily # domain.com/old_page.html to domain.com/new_page.html RewriteRule ^old_page.html$ new_page.html [R,NC,L] # SEO / Pretty 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] # Pretty URLs with pagination (no query string) # domain.com/section/title/5 to domain.com/section.php?name=title&page=5 RewriteRule ^section/([A-Za-z0-9-]+)/([0-9]+)/?$ section.php?name=$1&page=$2 [L]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.