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 8974099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:36:14+00:00 2026-06-15T18:36:14+00:00

I have a PHP page with querystring: http://project.dev/?a=b&c=d As you know, I can access

  • 0

I have a PHP page with querystring:

http://project.dev/?a=b&c=d

As you know, I can access the querystring with $_GET superglobal array:

print_r($_GET);
/*
Array
(
    [a] => b
    [c] => d
)
*/

I want to remove questionmark from querystring with Apache and htaccess, so when a user see my website with this address:

http://project.dev/a=b&c=d

It will be identical to this address:

http://project.dev/?a=b&c=d

and I can access the querystring as before: with $_GET superglobal array.

Some Important Notes:

  1. I don’t want to redirect user from URL without question mark to the URL with question mark.

  2. I have both GET and POST requests to this page.

  3. The querystring can have questionmark ? itself, for example:
    http://project.dev/?a=b&c=d?x=y.

  4. I want the addresses with question mark, automatically redirect to the one without question mark. For example when a user come to my site with this address:
    http://project.dev/?a=b&c=d
    I want to redirect user to this address:
    http://project.dev/a=b&c=d.

  5. My website has only one page: index.php. Without any subfolders.

How can I do this in htaccess?

  • 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-15T18:36:16+00:00Added an answer on June 15, 2026 at 6:36 pm

    I have both GET and POST requests to this page.

    This may be an issue, since the request body doesn’t get included after a redirect. So if you’ve POSTed a request that has GET style params in the query string, the redirect will lose the POST params.

    The rules you want will probably look something like this:

    # Redirects query string to non-query string
    
    RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /\?([^\ ]+)
    RewriteRule ^ /%2? [L,R,NE]
    
    # And back
    
    RewriteCond %{REQUEST_URI} .=.
    RewriteRule ^/?(.*)$ /?$1 [L]
    

    If you want a 301 redirect, replace the R flag in the first rule with R=301. The NE flag is needed s othat any encoded ? in the query string shows up as %3F instead of the % getting encoded itself. You can alternatively try replacing RewriteCond %{REQUEST_URI} .=. with -f and -d checks:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating pagging for some data. For example, I have a page: http://example.com/news.php?type=bla&smth=bla There
I have a list of URLs such as, http://www.mywebsite.com/page.php?genus=A_GENUS&species=A_SPECIES&id=12345 . I would like to
I have a query string like the one given below: http://localhost/project/viewMember.php?sort=Y2xhc3M=&class=Mw==&page=9 Now variable: page
I have this PHP page where the user can select and un-select items. The
I have a PHP page I need to limit execution access of to only
I have the following in my .htaccess file: RewriteCond %{QUERY_STRING} ^route\=product\/category\&path\=35\&page\=([0-9]+)$ RewriteRule ^index\.php$ http://%{HTTP_HOST}/product/category/35/page_$1?
I have the following url: http://example.com/folder/index.php?module=centrale&DIO0=1 I need this page to be availeble with
I have horrible URLs like this: http://example.com/subfolder/index.php?a=1&b=1&token=8d519decbe60db44154b1fbc8c553ac4 I am trying to make it look
I have a php page which hits an aspx page http://server/default.aspx?xml=abc , the file
I have a PHP page where i want to open a file on a

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.