HTACCESS Redirect not redirecting a certain page to another websites URL

I am editing an .HTACCESS file to redirect a link https://www.example.com/activity/siag_chair.php to a new link on another site https://www.newsite.org/newlink

The website is on a LAMP stack.

I will post below the examples I have tried. None have worked. But the 404 to /arc404.php. So I know the htaccess file at least works.

Example 1 :

RewriteEngine On
RedirectMatch 301/activity/siag_chair.php https://www.newsite.org/newlink
ErrorDocument 404 /arc404.php

Example 2 :

RewriteEngine On
Redirect 301 /activity/siag_chair.php https://www.newsite.org/newlink
ErrorDocument 404 /arc404.php

Example 3 :

RewriteEngine On
Redirect https://www.example.com/activity/siag_chair.php https://www.newsite.org/newlink
ErrorDocument 404 /arc404.php

I am honestly not sure whats wrong or what else to try.... Any advice on what to try next will help. thx!

Upvotes: 0

Views: 85

Answers (1)

Gerard H. Pille
Gerard H. Pille

Reputation: 2578

If I'm not mistaken, inside the htaccess, you don't see the leading "/", as you would in the apache configuration files. Try

RedirectMatch 301 activity/siag_chair.php https://www.newsite.org/newlink

Watch out, for RedirectMatch expects a regex as second parameter.

Upvotes: 1

Related Questions