0

I have a centos webserver with Apache/2.2.15. In the past I had la login page like this http://app.website.com/index.php?resource=Login and now I changed my website and I want to redirect this page to the new one. I puted in virtual host this redirect:

RedirectPermanent / https://newapp.website.com/

And now when I access this page http://app.website.com/index.php?resource=Login I am redirected to this page http://newapp.website.com/index.php?resource=Login and I receive 404. But I want to redirect me to the clean url, without "index.php?resource=Login" just http://newapp.website.com/. I want to solve this porblem because many users bookmarked the login page and now they receive 404 error. I will not change the website, I need a solution in apache or in .htaccess. Thanks

antiks
  • 263
  • 5
  • 14

1 Answers1

1

Redirect Directive appends trailing paths and query strings to its destination Url, Try mod_rewrite to solve this problem :

RewriteEngine On

RewriteCond %{THE_REQUEST} /index\.php\?resource=Login [NC]
RewriteRule ^  http://newapp.website.com/? [NC,L,R]

Empty question mark at the end is important as it will discard the original query string from url.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115