htaccess redirect of URL's containing query

dzhi

I have one URL, domain.com/fun/page/ which i want to redirect to itself when query string is appended to it (domain.com/fun/page/?xyz).

Server is LiteSpeed and no matter what (I've tried numerous rules found here and elsewhere on the web), I don't get what I want. Seems I'm just not skilled in writing matching regex.

anubhava

put this code in your /fun/.htaccess file:

RewriteEngine On
RewriteBase /fun/

RewriteCond %{QUERY_STRING} .+
RewriteRule ^page/?$ %{REQUEST_URI}? [NC,R=302,L]

Trailing ? will strip off any existing query string.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related