2

I moved my website to a new CMS and some of my URLs look different now, so I want to delete a part of incoming URLs so that links to my page still work properly.

The old URL looks like:

www.example.com/MY-FORUM/my-forum/category/postingtitle

I want to get rid of the MY-FORUM, so it looks like:

www.example.com/my-forum/category/postingtitle

After reading through different posts I tried the following:

RewriteRule ^MY-FORUM/(.*) /$1 [R=301,L]

Which gives me back an error message stating:

Infinite loop detected in JError

(I'm using joomla)

What is causing this?

2 Answers 2

1

I guess you are defining it in the <VirtualHost>, so the pattern must have a leading slash:

RewriteRule ^/MY-FORUM/(.*) /$1 [R=301,L]
1
  • Although if the original rule didn't match then presumably the OP wouldn't be getting an "infinite loop".
    – MrWhite
    Commented Oct 31, 2015 at 21:11
1

The fact that you are getting a Joomla error would suggest that you are already getting past mod_rewrite. By itself, the above directive should not generate a redirect loop - assuming you don't have URLs that start /MY-FORUM/MY-FORUM/?

However, Joomla itself uses mod_rewrite, so it's possible there is a conflict with other directives. Since this is an external redirect it should come near the start of your script, after the RewriteEngine On directive and before any of Joomla's internal rewrites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.