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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:55:58+00:00 2026-05-25T13:55:58+00:00

I am creating a htaccess file, I currently have a long url looking like

  • 0

I am creating a htaccess file, I currently have a long url looking like this:

domain.com/file.aspx?id=1000&AE=value1&PL=value2

I want to redirect it to look like:

seconddomain.com/directory/subdirectory/1000

(i.e. just use the value of the ID key passed).

This is what I’m using:

RewriteEngine on 
RewriteCond %{QUERY_STRING} ^id=([0-9]+).*$
RewriteRule ^file.aspx$ http://seconddomain.com/directory/subdirectory/%1 [R=301,L]

However, what I end up getting is:

http://seconddomain.com/directory/subdirectory/1000?id=1000&AE=value1&PL=value2

i.e. the value of ID gets put in the correct spot — however, the full query string is appended. I do not have a QSA flag.

What am I doing wrong?

Thank you in advance.

  • 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-25T13:55:58+00:00Added an answer on May 25, 2026 at 1:55 pm

    I think the query string is automatically appended if you don’t set one yourself, try sticking a ? at the end of the redirect path to override that and see if that helps

    EDIT

    Just to clarify your code would look like this:

    RewriteEngine on 
    RewriteCond %{QUERY_STRING} ^id=([0-9]+).*$
    RewriteRule ^file.aspx$ http://seconddomain.com/directory/subdirectory/%1? [R=301,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my htaccess file RewriteBase / RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1
Creating a voting system just like stackoverflow. Questions like this have been asking several
I am creating php front controller. this is my .htaccess file. <IfModule mod_rewrite.c> RewriteEngine
I'm attempting the following in an HTACCESS file: I want to 301 redirect this
My backend URLs look like this: mysite.com/backend.php/blog I'd like to change it to: mysite.com/backend/blog
I'm failing at creating a script for my .htaccess file. I want the following
As I understand it, creating an htaccess file creates a scalability concern since every
I am creating .htaccess file first time and it doesn't work for me. My
I have a folder full of 2000 images, all unique and named like this:
I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2 I plan to have

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.