Browsing all articles in SEO
Apr
20

A good .htaccess file

Author Chris Cummings    Category SEO     Tags

I’m a bit new to this side of things but for now this is the .htaccess file I’m using when I want everything to point back to http://www.site.com/

RewriteEngine on

# Send index.php or index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?|php)(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]*/)*)index\.(html?|php)$  http://www.site.com/$1  [R=301,L]

# Force www
RewriteCond %{HTTP_HOST} !^www.site.com$
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301]

# Force trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://www.site.com/$1/ [R=301,L]

Also I should have figured this out years ago but I shouldn’t just reference index.php and the like in an href, do it up right with the full URL http://www.site.com/

Jan
30

Converting a site to WP but doing the right SEO stuff

Mainly what you have to do is:

  1. Convert the site to WP
  2. Once all is good with WP edit .htaccess
  3. Above all the wordpress stuff you have to add this type of thing: Redirect 301 /myoldurl.html http://mydomain.com/newpagename
  4. You have to add that for each old file that you want to redirect to the new file
  5. There is info all over the net, including here: http://stackoverflow.com/questions/3696002/converting-a-static-site-to-a-wordpress-site-how-to-transfer-convert-seo-ranki