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

  • Home
  • SEARCH
  • 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 7436291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:13:00+00:00 2026-05-29T10:13:00+00:00

npinti helped me create a regex to remove the querystring and match the remaining

  • 0

npinti helped me create a regex to remove the querystring and match the remaining segments from the url /seattle/restaurant/sushi?page=2: “Something like so should yield 3 groups: /(.*?)/(restaurant)/([^?]+).*. Group 1 being seatthe, group 2 being restaurant and group 3 being sushi. If after the last /there is a ?, the regex discards the ? and everything which follows.”

I have tried modifying the above to do the same trick on the url /seattle/restaurant?page=2 but I could not get it right. I don’t know if there will be af querystring or not or the parameters of the querystring. So I need the flexibility from the regex above which will match and discard the ? and everything which follows.

  • 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-05-29T10:13:00+00:00Added an answer on May 29, 2026 at 10:13 am

    Your rewriterules may look like:

    RewriteRule /([^/]+)/restaurant/([^/]+)$ mynewpage.php?group1=$1&group2=$2 [QSA,NC,L]
    

    Your may search for what QSA, NC, and L mean thanks to the links I provide below.


    I’m sorry but your question sound very like “I’m not very good, so can someone do the job for me?”. I mean, just look around, you’ll get a lot of answer, just get your hands dirty.


    • Here’s the wiki of serverfault.com
    • The howto’s htaccess official guide
    • The official mod_rewrite guide

    And if that’s not enough:

    Two hints:

    If you’re not in a hosted environment (= if it’s your own server and you can modify the virtual hosts, not only the .htaccess files), try to use the RewriteLog directive: it helps you to track down such problems:

    # Trace:
    # (!) file gets big quickly, remove in prod environments:
    RewriteLog "/web/logs/mywebsite.rewrite.log"
    RewriteLogLevel 9
    RewriteEngine On
    

    My favorite tool to check for regexp:

    http://www.quanetic.com/Regex (don’t forget to choose ereg(POSIX) instead of preg(PCRE)!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or
Is there an efficient way to determine if an image is in greyscale or

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.