Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:02:33+00:00 2026-06-09T16:02:33+00:00

I want to create a condition that if page has parameter in URL like

  • 0

I want to create a condition that if page has parameter in URL like ?print=1 – redirect this page to itself without any querystring.

Example:

I want this page:

http://sos-med.com/en/specific_page.html?print=1&ok=1 

tp redirect (301) to the same URL with no Query string:

http://sos-med.com/en/specific_page.html

My code is:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^*print=*$ [NC]
RewriteRule ^(.*)$ %{REQUEST_URI}?

I have no test server, so can you tell me if my code is ok?

The code above is for every page on website. And before implementing that rule I would like to try the redirect for one specific page (see my example).
How to modify the code to work with “specific_page.html” only?

I want only .htaccess solution, not PHP code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:02:35+00:00Added an answer on June 9, 2026 at 4:02 pm

    You’re close, your %{QUERY_STRING} regex isn’t right, and you’re missing the 301 redirect flag:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^print=.*$ [NC]
    RewriteRule ^(.*)$ %{REQUEST_URI}? [L,R=301]
    

    Try that.


    Thanks, and If I want to redirect single specific page: sos-med.com/en/aaa.html?print=1&ok=1 to sos-med.com/en/aaa.html ? –

    Then you’d change what the rule matches against:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^print=.*$ [NC]
    RewriteRule ^en/aaa.html$ %{REQUEST_URI}? [L,R=301]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simply login page. I want validation on that page
i want create multiple search where statement $where_search is a multiple condition from post
I want to create conditional comments in XSLT. But when I use this: <!--
I want create wordpress website into which I want create user management... That means
i want create a custom json data from the mssql 2008 results so that
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I want to create a new field (or two) in my table that is
I'm trying to make a web page that only has content within the page
I'm trying to produce a page that would function a bit like a digital
There is a webpage i am making a greasmonkey script for. This page has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.