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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:11:00+00:00 2026-05-20T23:11:00+00:00

Is there anyway using ModRewrite to achieve the following: Initial URL: http://example.com/page?value=test Rewirted URL:

  • 0

Is there anyway using ModRewrite to achieve the following:

Initial URL: http://example.com/page?value=test

Rewirted URL: http://example.com/page/value/test

OR

Initial URL: http://example.com/page?value=test&fruit=apple

Rewirted URL: http://example.com/page/value/test?fruit=apple

I need this rule to be dynamic as I don’t know all the pages it is going to be used for and I also need to retain the $_GET variables in PHP.

Thanks

  • 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-20T23:11:01+00:00Added an answer on May 20, 2026 at 11:11 pm

    The question makes sense if the URLs in question are stored in the database, and need to be rewritten until the content can be updated to reflect the new URL pattern. Which, for clarification of the question, would be considered a redirect not rewrite, therefore improving SEO. Then, as the comments above point out, the URL could then be rewritten to provide PHP the correct URL parameters. If this what James intended, the config below will help out:

    ### 301 redirect old query string URLs to pretty URLs
    ### This will help search engines index the new URLs, 
    ### not ones that are linked in content
    ### This is rather messy due to the 
    ### http://example.com/page/value/test?fruit=apple example
    RewriteCond %{QUERY_STRING} value=([^&]*)
    RewriteRule (.*) /page/value/%1 [R=301,E=rewrite:true]
    
    RewriteCond %{ENV:rewrite} true
    RewriteCond %{QUERY_STRING} !&
    RewriteRule (.*) $1? [R=301,L]
    
    RewriteCond %{ENV:rewrite} true
    RewriteCond %{QUERY_STRING} &([^=]*)=(.*)$
    RewriteRule (.*) $1?%1=%2 [R=301,L]
    
    ### Rewrite pretty urls with usable parameters
    ### [QSA] will maintain extra params such as &fruit=apple
    RewriteRule /page/value/(.*) /page.php?value=$1 [QSA]
    

    This is messy, but I’ve run into similar situations where redirecting old URLs stored in the database was necessary until content could be updated.

    Hope this helps.

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

Sidebar

Related Questions

Is there anyway to grab the referring URL using javascript, lets say the reffering
I am using python unit test module. I am wondering is there anyway to
Is there anyway to recreate the following interface in PHP using the PHP CLI
Is there anyway to test the navigation functionality in MonoTouch using the iPhone simulator?
Is there anyway to avoid using LIMIT $page,$offset when retrieving rows in codeigniter pagination?
Is there anyway using the ITask interface to communicate with a scheduled task? I
Is there anyway to restrict by using pre-processing directives to prevent a project from
Is there anyway to create C# spelling checker without using Office library? I would
Is there anyway, using google analytics, to track a user's journey/selections through a long
I'm using ASP.NET 4. C#. Is there anyway to call a Javascript function 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.