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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:34:19+00:00 2026-05-26T10:34:19+00:00

I have spent some time learning how to do rewrites and have had success

  • 0

I have spent some time learning how to do rewrites and have had success with it but cannot seem to get past this. I have a site that will have a url like http://www.domain.com/bystate.php?s=Massachusetts that I want to change to http://www.domain.com/Massachusetts, I did this with the following rule.

RewriteRule ^([a-zA-Z-/]+)$ bystate.php?s=$1

Now the probles is once in that page the user chooses a city and needs to be directed to http://www.domain.com/Massachusetts/west-newburyport

I have been trying to get this to work but it seems to stop at the first rul because it meets the conditions. I tried putting the second rule on top of the first and it didnt work. I also tried adding in a word ‘directory’ to try and get this to work, again nothing.

What am I doing wrong? Heres where I am.

RewriteRule ^([a-zA-Z-/]+)$ bystate.php?s=$1
RewriteRule ^([a-zA-Z-/]+)/([a-zA-Z-/]+)$ bycity.php?s=$1&c=$2

  • 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-26T10:34:20+00:00Added an answer on May 26, 2026 at 10:34 am
    RewriteRule ^([a-zA-Z0-9-]+)(/(.+))?$ /bystate.php?s=$1&c=$3 [QSA,L]
    

    should work just fine?!

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

Sidebar

Related Questions

I have asked this question before - but I have spent some time thinking
This has probably been answered before, but I have spent some time looking and
I have spent some time learning what are Java Native methods and that they
I have spent some time now to solve a problem for which i have
I have spent too much time on this problem and am beginning to think
I have spent quite some time making a function and the last 15-20 minutes
I spent some time googling but didn't really find anything. I want to be
For the past 5 months or so, I've spent time learning C# using Andrew
I have spent some time trying to create a child window of an existing
Having spent some time working on data warehousing, I have created both ETL (extract

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.