<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SEO Land: Get Latest SEO News &#187; htaccess</title>
	<atom:link href="http://blog.seoland.co.uk/category/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.seoland.co.uk</link>
	<description>Internet Marketing News with SEO Land</description>
	<lastBuildDate>Tue, 22 Nov 2011 03:00:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>10 htaccess Hacks Every SEO Should Know</title>
		<link>http://blog.seoland.co.uk/10-htaccess-hacks-every-seo-should-know/</link>
		<comments>http://blog.seoland.co.uk/10-htaccess-hacks-every-seo-should-know/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 04:47:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[htaccess]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Know]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://blog.seoland.co.uk/?p=542</guid>
		<description><![CDATA[There’s a lot that you can do with an htaccess file, and of course, things can get pretty advanced in a hurry. Here, we’re going to keep things pretty simple. These are the 10 basic htaccess hacks that every webmaster should know. 1. Force Caching with htaccess Use: The following htaccess code won’t help the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.seoland.co.uk%2F10-htaccess-hacks-every-seo-should-know%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.seoland.co.uk%2F10-htaccess-hacks-every-seo-should-know%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">There’s a lot that you can do with an htaccess file, and of course, things can get pretty advanced in a hurry. Here, we’re going to keep things pretty simple. These are the 10 basic htaccess hacks that every webmaster should know.</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">1. Force Caching with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Use: The following htaccess code won’t help the initial pageload, but it will significantly help subsequent pageloads by sending 304 status when requested elements haven’t been modified.</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">FileETag MTime Size<br style="padding: 0px; margin: 0px;" />ExpiresActive on<br style="padding: 0px; margin: 0px;" />ExpiresDefault “access plus x seconds”</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">I generally set the cache for one day (86400 seconds). You can also set different expirations for each file type by breaking each file type up into separate ExpiresByType lines such as:</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">ExpiresByType image/gif “access plus x seconds”<br style="padding: 0px; margin: 0px;" />ExpiresByType text/css “access plus x seconds”</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Simple!</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">2. Set a Custom 404 Page with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Use: I think this one is self explantatory. Just change ‘/notfound.html’ to match the path to your custom 404 page.</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">ErrorDocument 404 /notfound.html</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">3. Implement a 301 Redirect with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Use: If you have permanently changed the URL structure on your site (via either optimization change or CMS migration), you will want to implement 301 redirects from the old URL to the new URL.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">The syntax for a basic 301 redirect is:</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">Redirect 301 relative/path/to/oldurl/ http://www.domain.com/newurl/</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Explanation:<br style="padding: 0px; margin: 0px;" />The first URL should be a relative path to the old URL and the second one should be an absolute path to the new URL.</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">4. Only allow specific IP addresses in certain directories</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">This is especially useful for admin directories. I generally set my home IP and work IP as the only allowable IPs who can even attempt a login. Unlike other .htaccess hacks, this one doesn’t work from the root folder. You will need to create a new .htaccess file, put the following code in it, and upload it to your admin directory.</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">AuthUserFile /dev/null<br style="padding: 0px; margin: 0px;" />AuthGroupFile /dev/null<br style="padding: 0px; margin: 0px;" />AuthName “Example Access Control”<br style="padding: 0px; margin: 0px;" />AuthType Basic</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">order deny,allow<br style="padding: 0px; margin: 0px;" />deny from all<br style="padding: 0px; margin: 0px;" />allow from xx.xx.xx.xx</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">To allow a second IP, just add another ‘allow from’ line.</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">5. Prevent Image Hot Linking with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">If you check your server logs with any frequency, you’ve undoubtedly seen an image that you’re paying to host hotlinked on some crazy popular forum somewhere and your bandwidth goes down the crapper.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Now, if you wish, you can prevent hotlinking altogether. But I’d rather take advantage of the opportunity and throw a 2kb gif with my URL out there to hit some new eyeballs.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">To do this, you just have to replace the requested image with a new one.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">This code simply declares the extensions of files you would like to protect, and rewrites the requested URL to your image path if the domain is not yours.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">The [NC] command means that the preceeding string is not case sensitive. The [L] command means that it is the last rule that your htaccess should execute on this request.</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">RewriteEngine on<br style="padding: 0px; margin: 0px;" />RewriteCond %{HTTP_REFERER} !^$<br style="padding: 0px; margin: 0px;" />RewriteCond %{HTTP_REFERER} !^http://(www.)?yourdomain.com(/)?.*$ [NC]<br style="padding: 0px; margin: 0px;" />RewriteRule .(gif|jpe?g|png|bmp)$ /images/humiliatingimage.gif [L,NC]</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">6. Enable gzip with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Gzip is a means of compressing the files on your server so they will load faster. To enable gzip, just</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript<br style="padding: 0px; margin: 0px;" />BrowserMatch ^Mozilla/4 gzip-only-text/html<br style="padding: 0px; margin: 0px;" />BrowserMatch ^Mozilla/4.0[678] no-gzip</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">BrowserMatch bMSIE !no-gzip !gzip-only-text/html</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">7. Remove ‘category’ from a URL with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Many content management sytems use the ‘category’ URL segment. For instance:</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">http://makeitrank.com/category/category-name</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Well, that’s fine, and it’s necessary to make the CMS work the way it’s supposed to, but it doesn’t need to be visible to do its job. Just drop the following code into your htaccess file to get rid of it.</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">RewriteRule ^category/(.+)$ http://www.yourdomain.com/$1 [R=301,L]</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">8. Define any page as the home page with htaccess</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">You can set any page as the homepage by adding the following to the htaccess file in your root directory.</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">DirectoryIndex myfile</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">9. Disable Directory Browsing</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">You want to keep people out of any directories that might reveal security weaknesses — for instance, plugin directories.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">You can block vistors from browsing the directories by adding the following line to the htaccess file in the directory you’d like to block:</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">Options All -Indexes</p>
<h3 style="margin-top: 1.8em; margin-right: 0px; margin-bottom: 0.6em; margin-left: 0px; font-weight: normal; font-size: 1.25em; line-height: 1.2em; color: #111111; text-align: justify; padding: 0px;">10. Protect your htaccess file</h3>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Lastly, you want to protect your htaccess file. Hopefully your host has protected it for you, but you can’t be too safe with these things. The following hack will prevent anybody from accessing your htaccess:</p>
<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify;">order allow,deny<br style="padding: 0px; margin: 0px;" />deny from all<br style="padding: 0px; margin: 0px;" />satisfy all</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">Are there any useful htaccess hacks I’ve left out? Let me know!</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; text-align: justify; padding: 0px;">source: makeitrank.com</p>
<a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://blog.seoland.co.uk/10-htaccess-hacks-every-seo-should-know/&title=10+htaccess+Hacks+Every+SEO+Should+Know&srcURL=http://blog.seoland.co.uk" target="_blank" rel="nofollow"><img
src="http://blog.seoland.co.uk/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a>]]></content:encoded>
			<wfw:commentRss>http://blog.seoland.co.uk/10-htaccess-hacks-every-seo-should-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

