Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
PHP changed Parameter redirect by htaccess

I want to redirect my dynamic links to new parameter.

My Old code for Files:

https://www.example.com/index.php?a=browse&b=category&id=[DYNAMIC ID IN NUMBERS]

I want new for Files :

https://www.example.com/index.php?a=downloads&b=file&id=[DYNAMIC ID IN NUMBERS]

How to do that in .htaccess?

My current .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
</IfModule>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

To redirect the "old" URL to the "new" whilst maintaining the "old" dynamic id, try the following before your existing directives:

RewriteCond %{QUERY_STRING} ^a=browse&b=category&id=(\d+)
RewriteRule ^(index\.php)$ https://www.example.com/$1?a=downloads&b=file&id=%1 [R=301,L]

The $1 backreference simply matches index.php and saves repetition.

The %1 (as opposed to $1) is a backreference to the captured pattern in the preceding CondPattern ie. the value of the id URL parameter.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!