Title: REGEX
Last modified: August 22, 2016

---

# REGEX

 *  [DBJ](https://wordpress.org/support/users/dbj/)
 * (@dbj)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/regex/)
 * basic (basic) howto will help here 🙂
 * I need to redirect everything from dbj.org/dbj to dbj.org
 * SO in all of my innocence I tried regex + this :
 * from: /dbj/*
    to: /*
 * and then, I thought perhaps the whole thing has to be in regex syntax:
 * from: \/dbj\/.*
    to: \/.*
 * But I am fishing here … is there a basic intro on how to use regex ?
 * [https://wordpress.org/plugins/redirection/](https://wordpress.org/plugins/redirection/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [11 years, 6 months ago](https://wordpress.org/support/topic/regex/#post-5491741)
 * This plugin _may_ not be the way to go here. Can you provide some real URLs as
   an explanation?
 * I used `.htaccess` via `mod_rewrite` to do that without a plugin and with some
   examples I may be able to walk you through the same results.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [11 years, 6 months ago](https://wordpress.org/support/topic/regex/#post-5491742)
 * _*Drinks more coffee, sees that my question has already been answered*_
 * > I need to redirect everything from dbj.org/dbj to dbj.org
 * Try this at the top of your `.htaccess` file.
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteRule ^dbj/(.*) http://dbj.org/$1 [R=301,L]
       </IfModule>
       ```
   
 * Get ready to delete that quickly in case it creates a redirect loop. 😉
 *  [simonmc](https://wordpress.org/support/users/simonmc/)
 * (@simonmc)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/regex/#post-5491792)
 * or you could use /dbg(.*) rediret to /
 * If you have more directories after /dbg you could try
 * ^/dbg/.*

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘REGEX’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [simonmc](https://wordpress.org/support/users/simonmc/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/regex/#post-5491792)
 * Status: not resolved