We switched to Drupal quite a while ago, but after looking at the server logs, I see people are still looking for us at the old CMS addresses. It was a Joomla install so the addresses are like www.example.com/joomla/index.php?option=com_events&task=.... I just want to redirect them all to the root (www.example.com/) of the new site.

I want to add it to vhost.conf but I haven't been able to get anything to work. All my try's end up with all the URL after index.php being added to the root address of the new site (www.example.com/?option=com_events&task=...).

I'd appreciate any advice.

Comments

sreyas’s picture

Seems like you had a joomla folder for your cms earlier. So try recreating the joomla folder there and inside that add this .htaccess file

RewriteEngine on
RewriteRule (.*) http://www.example.com  [L,R=301]

------------------
Ciril Sreedhar
Sreyas IT Solutions
Server Administration | Web Designing | Web Programming

wxman’s picture

Thanks, I'm trying that now.
There must be a way to do it through httpd.conf or vhost.conf though.

briansea’s picture

If you include a ? at the end of the url to which the user will be directed, mod_rewirte won't include the original url's query string.

This should do it.

RewriteCond %{REQUEST_URI} ^/joomla
RewriteRule .* /? [L,R=301]
wxman’s picture

Thanks Brian, unfortunately that didn't work. I tried to do it for a similar item; my now defunct serendipity blog. It had the same type of URL like www.example.com/serendipity/index.php?/9-blog-entry-title.html. I added it to my vhosts.conf and restarted apache. It's still adding the URL to the end.

briansea’s picture

It sounds like you have some other rewrites happening before it gets to this one. I tested what I sent to you, and it does work, at least when it isn't after other rules.