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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:59:46+00:00 2026-05-16T02:59:46+00:00

I have a set of rewrite rules that are supposed to process a URL

  • 0

I have a set of rewrite rules that are supposed to process a URL that has anywhere from 1 to 5 parameters. So my URL might look like this:
http://www.site.com/topic1/page1 or http://www.site.com/topic1/sub1/page1.

Here are my rules in this example:

RewriteRule ^([^/.]+)/?$ /staticpages/process-selection.php?param1=$1 [E=rwdone:yes,L]
RewriteRule ^([^/.]+)/([^/.]+)/?$ /staticpages/process-selection.php?param1=$1&param2=$2 [E=rwdone:yes,L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/]+)/?$ /staticpages/process-selection.php?param1=$1&param2=$2&param3=$3 [E=rwdone:yes,L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/]+)/([^/]+)/?$ /staticpages/process-selection.php?param1=$1&param2=$2&param3=$3&param4=$4 [E=rwdone:yes,L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/]+)/([^/]+)/([^/]+)/?$ /staticpages/process-selection.php?param1=$1&param2=$2&param3=$3&param4=$4&param5=$5 [E=rwdone:yes,L]

To complicate matters, I might have a redirect 301 from an old URL to one of these new URLs. So “/topic1/page1/oldpage” might first get re-directed to “/topic1/page1/newpage”.

For some reason, when the rewrite occurs, the URL that shows up in the browser has the correct URL, but with the old variables appended to the url like this:
/topic1/page1/newpage?param1=page1&param2=oldpage

I’m wondering if there’s any way to avoid this situation. what the heck am I doing wrong here.

  • 1 1 Answer
  • 1 View
  • 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-16T02:59:47+00:00Added an answer on May 16, 2026 at 2:59 am

    mod_alias works later then mod_rewrite, and the [L] flag is only valid for mod_rewrite rules, not mod_alias (i.e. those rules would still be applied to the original URL, but strangely enough apparently with the new querystring). To enable mod_alias to see the already rewritten url, use the [PT] flag, or alternatively try to do all rewriting / redirecting with mod_rewrite.

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

Sidebar

Related Questions

I have a fairly complex set of rewrite rules to give my site pages
I have set up some User Friendly URL rules in IIS7 using the URL
I have been trying to write a set of htaccess rules that will do
I have the following rewrite set up: RewriteRule r/(.*) scripts/report.php?cp=1&id=$1 It works great to
In my .htaccess file I have a set of rules as follows: RewriteRule ^dir/page1$
I have set the eclipse java formatter to wrap lines that exceed 120 characters
I have set a background on the data-role=page element like so <div data-role=page style=background:
I have an SSL certificate and have set up a rewrite rule in my
I have the following problem: I use a script that saves the referer URL.
I want to set a 'default' rewrite rule to catch anything that didn't match

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.