My current page-url looks like the below,
http://localhost/testWP/?mode=home
but I want to make the url like the following:
http://localhost/testWP/mode/home
- How do I write an appropriate
.htaccess
-file to turn this into reality?
My current page-url looks like the below,
http://localhost/testWP/?mode=home
but I want to make the url like the following:
http://localhost/testWP/mode/home
.htaccess
-file to turn this into reality?Try adding these rules to your document root:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+testWP/?\?mode=([^&\ ]+)
RewriteRule ^ /testWP/mode/%1? [L,R]
RewriteRule ^testWP/mode/(.+)$ /testWP/?mode=$1 [L]
Note that if you change your URL base (in your question it seems to be /testWP/
), you'll need to adjust the rules to reflect any changes you make by replacing testWP
with whatever is appropriate.