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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:39:44+00:00 2026-06-13T08:39:44+00:00

I try to convert a url parameter in folders using RewriteRule. Anyone can help

  • 0

I try to convert a url parameter in folders using RewriteRule.
Anyone can help me?.

Origin: search.php?term=red&cat=colors
Destination: /search/red/colors

  • 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-13T08:39:45+00:00Added an answer on June 13, 2026 at 8:39 am

    The top part of this answer clarifies how URLs get rewritten and redirected. Using “convert” is not really clear, as there’s 2 completely different things that can happen.

    To change a URL like /search.php?term=red&cat=colors to the nicer looking variation, you need to match against the actual request and redirect the browser:

    RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD)\ /search\.php\?term=([^&]+)&cat=([^&\ ]+)
    RewriteRule ^ /search/%2/%3/? [L,R=301]
    

    This makes it so when someone types in their browser the URL: http://mysite.com/search.php?term=red&cat=colors, they get externally redirected to http://mysite.com/search/red/colors, changing the URL in the address bar.

    Then in order to internally rewrite the nicer looking URL and route it back to the php script:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/?search/([^/]+)/([^/]+)/?$ /search.php?term=$1&cat=$2 [L]
    

    This does the reverse, but only internally so that the URL in the browser’s address bar remains unchanged while the content is served from search.php. You can do one or the other depending on what your need is, or you can do both if you need this to happen in both directions.

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

Sidebar

Related Questions

In Java you can try to convert any String value to Integer, but when
I'm using Lyx to produce a Latex document, and when i try to convert
I really try to find on google how can we convert .doc and .txt
I'm trying to use urlencode to convert the string: <a href=<?php print 'search.php?query='.quote_replace(addmarks($search_results['did_you_mean'])).'&search=1'?>> Actually,
An Id is passing in as a Url parameter. I try to make sure
When try to convert string value in date-time format some time string variable comes
I try to convert a number between 0 and 255 to hexadecimal format. If
When I try to convert between date and string in Flash CS4, I use
When I try to convert an HTTP POST response to JSONArray I get the
My problem is the following. I try to convert a string into double. In

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.