Is there a way to redirect from a URL to a page with parameters without changing the URL?

Viewed 66

Hi I'm creating a website, and I find myself editing the .htaccess file. I have made several attempts to redirect from a URL like /isexistinguser to /api/usermanager?type=1 without changing the address visible in the browser but still can't find a solution. Is there someone who can help me?

This is what I have tried:

RewriteEngine on
RewriteCond %{THE_REQUEST} /isexistinguser [NC]
RewriteRule ^ /api/usermanager?type=1 [NC,L,R]

The problems here are two:

  • the address changes on redirection
  • Any URL that contains /isexistinguser is considered in the condition, for example /isexistinguserblabla

Thank you!

1 Answers

With your shown samples, could you please try following. Please make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(isexistinguser)$ api/usermanager?type=1 [NC,L]
Related