1

I searched for this question but only came across very specific answers that I couldn't tailor to my requirements.

My URL now looks like this: https://example.eu/?action=changepassword and I want it to look like this: https://example.eu/changepassword so text ?action= gets deleted.

I tried to adapt this but it didn't work.

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
Mazurky
  • 43
  • 4

1 Answers1

3

With your shown samples, please try following htaccess rules file. Please also make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
##External redirect rules here....
RewriteCond %{THE_REQUEST} \s/?\?action=(\S+)\s [NC]
RewriteRule ^ %1? [R=301,L]

##Internal rewrite rules to handle query string in backend.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /?action=$1  [L]
RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93