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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:18:10+00:00 2026-05-28T11:18:10+00:00

—-EDIT— I have just realized that my explanation of the problem was missing an

  • 0

—-EDIT—

I have just realized that my explanation of the problem was missing an important piece of information.

The URL’s should only be redirected if second parameter is present.

So the rule should read:

Redirect any URL that has /d/ in it, ONLY if /d2/ is also found in the URL.

—-End Edit__

I have the need to 301 redirect all URL’s on a site that contain a specific parameter to the same URL, but with an additional directory included. All of the URL’s that require redirection contain a certain directory: /d/ Example:

http://www.mysite.com/category1/d/subcategory1/subdirectory2/

–Should Redirect to —

http://www.mysite.com/newdirectory/category1/d/subcategory1/subdirectory2/

The one thing in common with any of the URLs’ requiring redirection is that they all contain a directory /d/ in the URL, which always immediately follows the “category” directory as indicated in bold in sample URL’s above. I would then like to insert an additional directory in front of the category directory as indicated in bold in the sample URL’s above. The rest of the URL will remain the same.

Can anyone help with this? I’m relatively new to mod_rewrite and realize I can make a big mess if I don’t get it right.

Thanks in advance for anyone who can offer hlep

🙂

  • 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-28T11:18:10+00:00Added an answer on May 28, 2026 at 11:18 am

    Try this (edited to reflect change in question):

        RewriteEngine On
        RewriteBase /
    
        RewriteCond %{REQUEST_URI} ^.*/d/.* [NC]
        RewriteCond %{REQUEST_URI} ^.*/d2/.* [NC]
        RewriteCond %{REQUEST_URI} !/newdirectory/ [NC]
        RewriteRule ^(.*)/d/(.*)$ http://www.mysite.com/newdirectory/$1/d/$2 [R=301,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly mundane piece jQuery that toggles a div's visibility when a
This is an interesting problem that I have searched here and all over my
So to start, I have an array of XML files. These files need to
I recently ran against a very interesting site that expresses a very interesting idea
I have set of xml elements like this: <item code=<HTML_CODE> /> For example: <items>
I basically have the classic many to many model. A user, an award, and
&mdash; or &#8212; Is there a difference between these? Is one better-supported than the
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm using a DatePicker ( org.apache.wicket.extensions.yui.calendar.DatePicker — Javadoc ) in a form. The form
Using the titleFormat I have: $calendar.fullCalendar({ titleFormat: { month: 'MMMM yyyy', // September 2009

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.