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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:23:27+00:00 2026-05-27T23:23:27+00:00

How would you redirect (301?)?: test.com/?dep=CAR (the variable is dynamic, whatever comes after the=)

  • 0

How would you redirect (301?)?:

test.com/?dep=CAR (the variable is dynamic, whatever comes after the=)

to a subdirectory:

test.com/CAR/

This is what I’ve got so far:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{QUERY_STRING} ^dep=(.*)
RewriteRule ^.* / [L,R=301]

I test this on a localhost (WAMP).
And the main directory is localhost/newsite/
(localhost/newsite/?dep=CAR)
, but I guess that shouldn’t matter? Online or localhost.

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

    Try the following

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    
    #if it has a dep param, capture the value
    RewriteCond %{QUERY_STRING} (^|&)dep=([^&]+) [NC]
    #and redirect to /value/
    RewriteRule .* /%2/? [L,R=301]
    
    
    #if there is no dep param
    RewriteCond %{QUERY_STRING} !dep= [NC]
    #and capture the directory and pass as a dep param
    RewriteRule ^([a-zA-Z]+)/$ ?dep=$1 [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to translate or 301-redirect urls such as: www.domain.com/example.html to www.domain.com/example Here
I have a website mywebsite.com and I would like to do a 301 redirect
Would it be possible to set a 301 redirect for sub.domain.com to redirect to
I've redirected my domain http://domain1.com to http://domain2.com using a 301 redirect. Now i would
Hi i would like ask you about .htacess 301 redirect: I have many dynamic
Using OpenCart how would I use a 301 redirect to add www. to the
I would like to redirect the following as an example: A.olddomain.com.au/blah.html > A.newdomain.com/blah.html B.olddomain.com.au/blah.html
I want the htaccess Redirect 301 to do the following: http://mysite.com/article.php?id=123 to http://mysite.com/123 Another
I have 2 domains .com and .net. I would like to redirect the .net
What I would like to do is use htaccess to redirect (301, Permanent Redirect)

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.