Page redirects in htaccess file to remove one of a few subdirectories in URL

Posted on 2012-09-18
Last Modified: 2012-09-19
Hello everyone

I'm trying to implement a generic rewrite rule but am running into some problems. For example, the old url is and the new one is i.e. "/auditorium" is should be removed from the new url. There are a few posts about this, but nothing to create the redirect correctly.

This is what we currently have:
rewritecond %{request_uri} ^/auditorium/events/details/ [nc]
rewriterule ^(.*)$$1 [r=301,nc]
From what I can tell, the server isn't even hitting the rewritecond properly because the old url is still showing in the address bar.

Not sure if this matters, but the site is in Joomla. Thank you!
Question by:LaBowski
    LVL 26

    Accepted Solution

    Try this in your root .htaccess file

    RewriteEngine On
    RewriteBase /
    RewriteRule ^auditorium(/events/details/.*)$   $1 [R=301,NC,L]

    Open in new window

    Remember to check that mod_rewrite is included in the Apache httpd.conf, and that you have an Option FollowSymLinks  in a Directory entry in the httpd.conf or .htaccess file, without these mod_rewrite will not be available to you.

    Author Closing Comment

    Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now