Cannot get 301 redirect to work in .htacess - redirect

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?

Related

301 redirect htaccess and Nginx settings issues and .composer folder

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

Apache config issue

So I'm experiencing the following issue :
If I add this line in in my site.conf file it doesn't work:
RewriteEngine On
Redirect 301 /contact-us /contact
Redirect https://www.website1.com/ https://www.website2.com/
I've added it in the , is this wrong or should I add it in a different line.
Thanks.
Figured it out, add this in <virtualhost *:80>
Redirect permanent /contact-us /contact
Redirect permanent /motorists/products /products
Redirect permanent /about/directorate /about
Restart apache and test.

Redirect 301 to old site

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.

301 Permanent Redirect, Redirecting Incorrectly?

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!

Having troubles in cPanel with a redirect

I have created a subdomain on my website like such www.mysite.com/forum/
when someone goes to that link, I would like them to be redirected to www.forum.mysite.com
I have set a redirect up in cPanel, but it doesnt seem to redirect the folder. I have also tried setting it up under the sub domain and still not working, is there a htaccess code I can add ?
Any help would be awesome!
Thanks in advance!
CPanel will add this to the .htaccess in your site's public_html root folder. Check if cPanel is creating what you mentioned, if not try this:
RewriteEngine on
RewriteRule ^forum/(.*)$ http://www.forum.mysite.com/$1 [L,NC,R=301]