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.

2
  • Thanks for sharing your efforts, which url are you hitting in browser? Commented Oct 25, 2021 at 7:06
  • @RavinderSingh13 I don't know if I understand the question correctly... but in the html code I have <a href> tag like this <a href="example.eu/?action=changepassword">. Commented Oct 25, 2021 at 7:11

1 Answer 1

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] 
Sign up to request clarification or add additional context in comments.

3 Comments

This condition changed it to: example.eu/var/www/example.eu/changepassword
@Mazurky, where(on which path) is your htaccess file placed?
htaccess location: /var/www/example.eu/.htaccess BUT It's working now but I changed <a href> tag to: <a href="example.eu/changepassword">. I don't know if this is the right solution but it works. :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.