homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Need two different rewrite rules for content and links

Msg#: 4584563 posted 7:38 am on Jun 16, 2013 (gmt 0)

Hi Folks, I had a post previously and Lucy assisted with a rewrite rule. However, I realised in time that I have two requirements. This is a Joomla site with articles and a Link directory.
The rule to catch all old indexed traffic for articles was quite simple. But The link directory is slightly different and I realsise the rule I have will not work.
My rewrite rule looks like this (NOT yet deployed):
RewriteRule ^MJ/(.*) http://www.example.com/MA/$1 [R=301,L]

For articles the URLS are :
OLD : http://www.example.com/MJ/hospitality/hospitality-news/hotel-industry/1679-an-article-title
New : http://www.example.com/MA/hospitality/hospitality-news/hotel-industry/1679-an-article-title

For the directory the links look like :
Old : http://www.example.com/MJ/wsn/hotel-/a-great-hotel-759.html
New : http://www.example.com/MA/micedirectory/10277-a-great-hotel
(there is no html or file type)

I am sure I need two rules as the URLS for the directory are not the same format and my current rule will not work on them.
There are about 4000 entries so I am trying to simplify & speed the process for the server.

Can anyone assist with suggestions on the second rul - Maybe also the first rule I have needs to be changed so it does not clash with the second. I also have a htaccess in root and in the joomla directory - I assume the rules I need go in the root htaccess.

I really appreciate the input.
Best regards.

[edited by: phranque at 9:34 pm (utc) on Jun 16, 2013]
[edit reason] Please Use Example.com [webmasterworld.com] [/edit]



WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Msg#: 4584563 posted 8:01 am on Jun 16, 2013 (gmt 0)

Hey, I remember MJ and MA :)

Everyone is now going to wait for a moderator to exemplify your post so we can read what you wrote. I know you meant well. But when The Rules say "example.com" they mean precisely and literally the word "example"; everything else auto-links.

When you say "directory" you're talking about a file, right? It just happens to contain the Yellow Pages or equivalent. Not a directory as in /directory/index.html

Will the new "directory" URLs be completely different from the old ones, or did you just type too fast? If all that's involved is deleting the trailing .html along with the MJ/MA swap, that will be simple. Especially if you're not in the habit of using literal . periods in your pathnames. (If there are none, a simple [^.] will zip you right along to the .extension. If you do have dots, things get a little rougher along the edges.)

If, on the other hand, the new names are to be completely and unpredictably different from the old ones, we may be edging into php-script territory. In which case, don't look at me :)


Msg#: 4584563 posted 10:11 am on Jun 16, 2013 (gmt 0)

Hi Lucy - yes its me again.
This is a link directory script for joomla, so its not a "folder" it is a script serving links and link pages. The old site I am using is WSN Link Directory script - the new one is using SobiPro script and it has a different link format.

The URLs to the link pages generate as Ive pasted them - Ive just edited the website and actual link name. There is no trailing html,php etc in the new url. The other thing is the ID number is not the same as you can see, BUT the link Slug name is the same.
eg The-Hilton-Hotel-London

I will also check to see if the new link script can rewrite and that may help.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved