Tag Info

Hot answers tagged

3

To redirect everyone else, apart from your IP address (eg. 123.123.123.123), to the /blog subdirectory then you can use something like the following in .htaccess: RewriteEngine On RewriteCond %{REQUEST_URI} !^/blog/ RewriteCond %{REMOTE_ADDR} !=123.123.123.123 RewriteRule (.*) /blog/$1 [R=301,L] If the requested URI does not start with /blog/ and the IP ...


2

Just create a valid hostname filter in GA. 90% of the spam will never bother you again. Read the section on Ghost Referrals: http://www.analyticsedge.com/2014/12/removing-referral-spam-google-analytics/


2

Try: RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] This should work. Here is mine: RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]


2

You would seem to have a couple of problems. You are trying to implement extensionless URLs, but (as per your comment) you have file.html and a subdirectory called file in the same directory. Because of this mod_dir is automatically adding the slash onto the end of the URL and your .htaccess directives are copying this slash into the substitution, hence the ...


1

I may be missing something, but my first reaction is to not redirect (or rather internally rewrite?) if the file doesn't exist, but only when the URL does not already contain the version folder (eg. v01). For example, for .htaccess in the document root: # Internally rewrite to the latest version if not specified RewriteCond %{REQUEST_URI} !^/app/v\d\d/ ...


1

One way that comes to my mind would involve using PHP: $_SERVER['HTTP_REFERER'] You could check for the refering URL and implement a redirect accordingly: if($_SERVER['HTTP_REFERER']=="http://www.example.com/") { my_redirection_fuction(); } This is however a rather unreliable method since people can hide the refering url through browser privacy ...


1

This type of spam never accesses your site so blocking it in your htaccess file won't have any effect. To keep clean your GA you should stop it with filters You can either use the hostname solution Mike suggests or add filter for it. Go to Admin tab in Google Analytics Select the View you want to filter > Filter > New Filter In Filter Type choose ...



Only top voted, non community-wiki answers of a minimum length are eligible