Rectangle 27 0

Url rewriting in php with multiple query string variables using .htacces?

RewriteEngine on
RewriteBase /

# Skip actual files/directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# If the host matches
RewriteCond %{HTTP_HOST} ^www\.example\.com$
# And the request URI starts with page.php
RewriteCond %{REQUEST_URI} ^\/page\.php
# And the querystring matches tokenid=DIGIT&tokenname=TOKEN_NAME
RewriteCond %{QUERY_STRING} tokenid=\d&tokenname=(.*)
# Then rewrite the URI to TOKEN_NAME
RewriteRule ^(.*)$ %1? [L,R]

As far as the apache's rewrite module is concerned, you're correctly redirecting to /About Us page. You need to make sure that the URI actually exists. Adding a rewrite rule does not magically make that page available.

You might want to try it online, if you wish.

i have tried your suggestion, but i am getting error 404 page, i am not able to retrive the page content.

yes but i am fetching the page from database based on tokenid and tokenname and i am rewriting the url so that the user does not see the extra query string .