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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:10:47+00:00 2026-06-14T00:10:47+00:00

I am using Microsoft-IIS/7.5 on a hosted server (Hostek.com) I have an existing site

  • 0

I am using Microsoft-IIS/7.5 on a hosted server (Hostek.com)

I have an existing site with 2,820 indexed links in Google. You can see the results by searching Google with this: site:flyingpiston.com Most of the pages use a section, makerid, or bikeid to get the right information. Most of the links look like this:

flyingpiston.com/?BikeID=1068
flyingpiston.com/?MakerID=1441
flyingpiston.com/?Section=Maker&MakerID=1441
flyingpiston.com/?Section=Bike&BikeID=1234

On the new site, I am doing URL rewriting using .htaccess. The new URLs will look like this:

flyingpiston.com/bike/1068/
flyingpiston.com/maker/1123/

Basically, I just want to use my htaccess file to direct any request with a “?” question mark in it directly a coldfusion page called redirect.cfm. On this page, I will use ColdFusion to write a custom 301 redirect. Here’s what ColdFusion’s redirect looks like:

<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="http://www.newurl/bike/1233/">
<cfabort>

So, what does my htaccess file need to look like if I want to push everything with a question mark to a particular page? Here’s what I have tried, but it’s not working.

RewriteEngine on
RewriteRule ^? /redirect.cfm [NS,L]

Update. Using the advice from below, I am using this rule:

RewriteRule \? /redirect/redirect.cfm [NS,L]

To try to push this request

http://flyingpiston2012-com.securec37.ezhostingserver.com/?bikeid=1235

To this page:

http://flyingpiston2012-com.securec37.ezhostingserver.com/redirect/redirect.cfm
  • 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-14T00:10:48+00:00Added an answer on June 14, 2026 at 12:10 am

    There’s a couple of reasons what you’re trying isn’t working.

    The first one is that RewriteRule uses a regex, and ? is a regex metacharacter, which therefore needs be escaped with a backslash (\?) to tell it to match the literal question mark character.

    However, the second part of the problem is that the regex for RewriteRule is only tested against the filename part of the URL – it specifically excludes the query string.

    In order to match against the query string you need to use the RewriteCond directive, placed on the line before the rule (but applied in between the RewriteRule matching and replacing), acting as an additional filter. The useful bit is that you can specify which part of the URL to match against (as well as having the option for using non-regex tests).

    Bearing all this in mind, the simplest way to match/rewrite a request with a query string is:

    RewriteCond %{QUERY_STRING} .
    RewriteRule .* /redirect/redirect.cfm
    

    The %{QUERY_STRING} is what the regex is tested against (everything in CF’s CGI scope can be used here, and some other stuff too – see the Server Variables box in the docs).

    The single . just says “make sure the matched item has any single character”

    At the moment, this rule will preserve the existing query string – if you want to discard it, you can place a ? onto the end of the replacement URL. (If you need to use a query string on the URL and not discard the old version, use the [QSA] flag.)

    In the opposite direction, you’re losing the filename part of the URL – to preserve this, you probably want to append it onto the replacement as PATH_INFO, using the automatic whole-match capture $0.

    These two things together provides:

    RewriteCond %{QUERY_STRING} .
    RewriteRule .* /redirect/redirect.cfm/$0?
    

    One final thing is that you’ll want to guard against infinite loops – the above rule strips the query string so it will always fail the RewriteCond, but better to be safe (especially if you might need to add a query string), which you can do with an extra RewriteCond:

    RewriteCond %{QUERY_STRING} .
    RewriteCond %{REQUEST_URI} !/redirect/redirect\.cfm
    RewriteRule .* /redirect/redirect.cfm/$0?
    

    Multiple RewriteCond are combined as ANDs, and the ! negates the match.

    You can of course add whatever flags are required to the RewriteRule to have it behave as desired.

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

Sidebar

Related Questions

Using Microsoft SQL server 2008 I have a query that is in need of
I'm using NLog in my ASP.NET application hosted on IIS and Windows server 2003.
Using Microsoft SQL Server 2005, is there any way to see when a table
Using Microsoft SQL Server... declare @x xml set @x = '<Example>&lt;You &amp; Me&gt;</Example>' select
Using: Microsoft SQL Server 2008 Microsoft Visual Studio 2010 C# .NET 4.0 WinForms Ok
Using Microsoft Visual Studio 2010: Can I write this type of macro in C?
Details of the app are: ASP.NET project, local web server, hosted in IIS locally,
I have a wcf application hosted in iis that i am trying to package
I've got an ASP.Net application which manages the IIS server as follows: Successfully using
I am developing a WCF service hosted by IIS, using VSTS2008 + C# +

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.