I briefly explain my problem.
I created a new site through wordpress that I have installed in the root (www.miosito.it);
To install the site I moved the old site in the old folder (www.miosito.it/old); the problem is that Google has already indexed in the past the old well site, and then I would do a 301 redirect from (www.miosito.it) to (www.miosito.it/old).
I thought since this is the html file to act in this way:
RedirectMatch 301 ^/(. *)\. Htm http://www.miosito.it/old/$1.htm
but I get an error like
www .miosito.it / old / old / old / old / old.nomefile.htm
I noticed from various tests that the problem is that ending .htm .php fact if I replace it with no problems.
How can I fix?
Alternative solutions?
Thank you all
You are getting a redirect loop error because your Redirect pattern and target are indentical so You need to exclude the target uri from your pattern :
RedirectMatch 301 ^ /((?!old).*)\.Htm http://www.miosito.it/old/$1.htm
Clear your browser cache before testing this.
Related
I've had some hit and miss results setting up htaccess to forward on a couple of aged domains I acquired to my main site. I wouldn't describe myself as advanced more an enthusiastic intermediate so a nudge in the right direction would be greatly appreciated. I've checked answers but nothing definitive that I can see that relates to my specific issue and the composer folder. In Apache/Nginx I have in directives (http/https)
RewriteEngine On
ErrorDocument 404 https://my-main-site.com/my-page-or-blog-post/
I have 'Restrict the ability to follow symbolic links' unchecked as I have reference to symlinks in htaccess and so avoids a 500 error. I also have put up a static html page so if anyone hits the old aged domain it's not an automatic redirect they'll see the static HTML page with reference to the old/aged domain. So the 301 is sort of in the background but I'm getting a 302 result. My htaccess looks like this......
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^old-site-aged-domain.com$ [NC]
RewriteRule ^(.*)$ https://my-main-site.com/my-page-or-blog-post/ [R=301,L]
However when I go in to AHREFS and look at the backlink data it's showing a 302, however it does confirm http>https is working fine.
http://www.old-site-aged-domain.com/info-page.html
301
https://www.old-site-aged-domain.com/info-page.html
302
https://my-main-site.com/my-page-or-blog-post/
In my site root I also have .composer folder (as well as error_docs, .ssh, httpdocs, logs, .revisium_antivirus_cache), I'm sort of aware what the purpose of this is (PHP) but there are 2 further htaccess files in there, the second smaller htaccess file only has 'deny from all' as content. I wonder if this folder with these 2 htaccess files is presenting a problem/conflict i.e. 3 x htaccess files. The smaller htaccess file is in .composer/cache. The larger htaccess file is in .composer. Should I delete these 2 x htaccess files in .composer folder.
Thanks in advance for any help
James
rewrote htaccess on numerous occasions but without success
I have a _redirects file in my netlify directory structure
/
- site
-- _redirects
_redirects
https://example.netlify.com/ https://www.example.com/:splat 301!
https://www.example.com/post/196 https://www.example.com/comic/post-name
Problem:
The first redirection occurs successfully, but the 2nd one returns:
Page Not found
I have followed the documentation in https://www.netlify.com/docs/redirects/ but cannot find a cause of this issue.
I note 2 potential causes mentioned in the documentation:
You can also add redirect rules to your netlify.toml file.
^^ I have not tried this, but since it reads "also" I assume using _redirects file should be sufficient.
For Jekyll, this requires adding an include parameter to
config.yml.)
^^ I am not using Jekyll as far as I know, but my project does contain a config.yml file.
You will not be able to chain redirects on Netlify from what the docs read.
The redirect engine processes the first matching rule it finds, so more specific rules should be listed before more general ones
https://example.netlify.com/post/196 https://www.example.com/comic/post-name
/post/196 /comic/post-name
https://example.netlify.com/* https://www.example.com/:splat 301!
You can try without the first line above to see if https://example.netlify.com/post/196 redirects to https://www.example.com//comic/post-name. If it does not redirect, then there is no chaining in Netlify redirects.
Solved by adding:
[[redirects]]
from = "https://www.example.me/post/196"
to = "https://www.example.me/comic/post-name"
status = 200
to netlify.toml
source of solution: https://www.netlify.com/docs/redirects/
yesterday i switched my sites to a new server. now i have a problem, because one domain i now run as a subdomain, was previously accessed as a subfolder and a few sites, which I have no access to, are still using that domain.com/subfolder/?some=parameters
so, long story short:
i need to update my nginx config file, to redirect my users from domain.com/subfolder/?some=parameters to subfolder.domain.com/?some=parameters
i searched for a solution for that problem yesterday, but couldn't fix the problem.
currently i have this in my conf file:
location /subfolder/ {
rewrite ^/subfolder(/.*)$ http://subfolder.domain.com$1 permanent;
}
which obviously redirects all requests from domain.com/subfolder/?some=parameters to subfolder.domain.com/?some=parameters, but requests to domain.com/subfolder/styles.css aren't redirected.
I think this is due to a conflicting location directive for specific static file extensions in your nginx config. I was able to get your rule to work by making it use a regular expression which influences the priority.
location ~ /subfolder/.* {
rewrite ^/subfolder(/.*)$ http://subfolder.domain.com$1 permanent;
}
See the details about the location directive, especially the rules and examples there about precedence.
I'm trying to redirect traffic that attempts to access:
cat.rs.allgames.com/cloud/11/services/titles/game5/console/file.json
to:
cat.cloud.allgames.com/titles/game5/console/file.json
using a 301 permanent redirect in an .htaccess file, but it always sends me to:
cat.cloud.allgames.comcloud/titles/game5/console/cloud/11/services/titles/game5/console/file.json
which is nowhere near correct. What am I doing wrong?
My .htaccess is located in:
cat.rs.allgames.com/cloud/11/services/titles/game5/console/file.json
and looks like this:
Redirect 301 / http://cat.cloud.allgames.com
The Rewrite module should do what you want! You need to make sure the rewrite module is enabled (for ubuntu: sudo a2enmod rewrite), then add this to your .htaccess file.
RewriteEngine On
RewriteRule ^/cloud/11/services/titles/(.*)$ http://cat.cloud.allgames.com/titles/$1 [R=301]
Here, the ^/cloud/11/services/titles/(.*)$ catches anything after the titles part of the URL. Then the $1 at the end of the second part attaches what we caught to the end of the new URL. Finally, you can specify it as an external 301 rewrite to another server with the [R=301] flag!
Hope that works for you!
I have been looking through the various threads related to .htacess 301 redirects and I simply cannot find a solution to my problem. I have added this into the .htaccess which was previously an empty file...
redirect 301 http://www.architekogp.com/index.html http://www.owenprescott.com/index.php
The .htaccess is located in the architekogp.com root folder (public_html/.htaccess). I am not sure if the .html to .php is causing the issue? Thanks in advance for any advice.
Wait so all all your code in .htaccess is:
redirect 301 http://www.architekogp.com/index.html http://www.owenprescott.com/index.php
Correct?