1

I'm having trouble with a redirect that I thought should be pretty simple.

Here's what I have:

redirect 301 /datatools.php  https://www.newsite.com/?p=1613 

However, when I type www.oldsite.com/datatools.php, it keeps taking me to www.newsitecom/datatools.php instead of the URL that I listed in the redirect.

Joe
  • 4,877
  • 5
  • 30
  • 51

1 Answers1

0

This is how Redirect works

Then any request beginning with URL-path will return a redirect request to the client at the location of the target URL. Additional path information beyond the matched URL-path will be appended to the target URL.

This is the reason why datatools.php is appended to https://www.newsite.com/.


If you want to replace the source URL, you can try mod_rewrite or RedirectMatch, which allows to throw away all or parts of the original request URI

RedirectMatch /datatools.php  https://www.newsite.com/?p=1613

When everything works as it should, you may change the status code to 301. Never test with 301.

Community
  • 1
  • 1
Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198