Tag Info

New answers tagged

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/ ...


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 ...


0

You need to use %1 (not $1) in your "2nd attempt" (as you did in your 1st attempt) and it looks like you should be almost there: RewriteCond %{QUERY_STRING} ^/page/index.html/(.*)$ RewriteRule ^index.php /index.php?/article.html/%1 [L] Although if you're in .htaccess you need to also remove the slash prefix from the RewriteRule pattern. %1 is a ...


0

I'm sure there must be a more elegant/efficient way of writing this, but this should work to do what you require: RewriteEngine On RewriteBase / # Restrict users from IP address 10.8.0.11 to user1 sub-folder RewriteCond %{REMOTE_ADDR} 10\.8\.0\.11 RewriteRule ^(user1) user1 [L] RewriteCond %{REMOTE_ADDR} 10\.8\.0\.11 RewriteRule ^(.*)$ user1/$1 [L] # ...


0

If you are only changing of domain name while keeping the rest of the URLs identical, then handling redirects for some special pages separately will not provide any SEO benefits. Bulk is fine. If the URLs change on top of changing of domain name, you must make sure the redirects are correctly implemented for each page and that might mean using special cases ...


0

The issue of one.com not accepting the same IP address for the A record of 2 domains to me suggests the provider has a slightly odd or bespoke setup, and this limitation is in their control panel, and not the capability of their server to manage 2 domains on one IP address. I manage large numbers of domains on single IP addresses without any problems, ...


0

I'm gonna assume each domain you're inquiring about are assigned separate document root folders on the same server. I'll assume the document root for abc.com is in the /abc/public_html folder, and document root for xyz.com is in the /xyz/public_html folder. Because you don't want xyz.com to show up and you want data from it, you have a couple of options. ...


0

My .htaccess is in the same directory as the index.php, so: localhost/projects/project1/.htaccess That's the problem, or rather your RewriteRule pattern is the problem, depending on how you look at it. In .htaccess (per-directory) files, the per-directory prefix is first removed from the URL before matching against the pattern. So, if your .htaccess ...


0

It looks like a possible cause can be you have two conflicting MIME types. Here is a solution provided by Microsoft: https://support.microsoft.com/en-us/kb/942050


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 ...


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 ...


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 ...


0

This may be a silly suggestion, but are you sure the site you are using is linux and uses a htaccess files? I recently inherited some web properties, only to realise that despite having a htaccess file, changes I was making weren't being applied as the server was Windows, and not linux.


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/


0

The best way to go is to create an .htaccess file with the following contents: RewriteEngine On RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] Then copy that file to the document root of each domain. Normally a document root is right in the public_html if your web server is setup like most. Then use redbot.org and test everything by plugging in ...


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]



Top 50 recent answers are included