Reputation: 48
So my current URL is: https://example.com/uDoc?id=xx
Using the rewrite, I'd like it to be https://example.com/display?id=xx&type=doc
The real problem is, that because I also have a rule(RewriteRule (.*) $1.php [L]
) for silently adding the .php (uDoc?id=xx -> uDoc.php?id=xx, without it, it would result in a 404 error).
Which is somewhat interfering with the current answer given.
I have fiddled around with various htaccess rules, but I got no good results :(
I'd really appreciate it if someone could help me, when it comes to htaccess rules, I'm totally giving up...
Upvotes: 1
Views: 71
Reputation: 784918
You can use this rule in your root .htaccess:
RewriteEngine On
RewriteRule ^uDoc/?$ display?type=doc [L,QSA,NC]
QSA
flag ensures your existing query string i.e. id=xx
is carried over to new URI.
Upvotes: 2