LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Apache Redirect Help! (https://www.linuxquestions.org/questions/programming-9/apache-redirect-help-717444/)

Jude Terror 04-07-2009 09:47 AM

Apache Redirect Help!
 
Hey, I know this question might be outside the usual realm for this forum, but I thought I might have luck in a place full of programmers than I did at the Joomla forums.

I have recently merged two Joomla 1.0 sites I ran into one. I imported the articles I wanted to keep to the new site, and I have the old site's domain pointing as an alias at the new site. The new site is www.theouthousers.com . The old site was www.bludblood.com .

I also have the core SEF URLs on, suing the htaccess.txt file that came with Joomla.

I have one writer for the old site who linked to his articles in various places, so I am trying to set up redirects for him so that he doesn't have to change all of his links.

For instance, I need something like:

http://www.bludblood.com/joomla/inde...d=25&Itemid=51

To redirect to the equivalent location on the new site:

http://www.theouthousers.com/content...tegory/84/163/


And I also need specific links like:

http://www.bludblood.com/content/view/700/51/

To redirect to their new counterparts:

http://www.theouthousers.com/content/view/3031/163/

Keeping in mind that www.bludblood.com is now an alias of www.theouthousers.com, is there any way to do this? I have been trying with rewrite rules and redirects, and cannot seem to achieve the desired effect.

Tried various versions of:

Code:

Redirect http://www.bludblood.com/joomla/index.php?option=com_content&task=blogcategory&id=25&Itemid=51  http://www.theouthousers.com/content/blogcategory/84/163/
With the http, without, as regexps, as 301s, as permanents, etc, and it just will not work. Also tried as RewriteRule.

Anyone familiar with this?

Jude Terror 04-07-2009 09:49 AM

Code:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
RewriteRule ^(content/|component/) index.php


This is the other rewrite stuff in .htaccess for Joomla's core SEF component.

Jude Terror 04-07-2009 11:47 AM

Frustratingly, I'm able to MOSTLY get this to work, but though it isn't causing a problem, it is appending everything after index.php onto the end of the URL. I used this code to get the redirect to work:

Code:

RewriteCond %{REQUEST_URI}  ^/joomla/index\.php$
RewriteCond %{QUERY_STRING} ^option=com_content&task=blogcategory&id=25&Itemid=51$
RewriteRule ^(.*)$ http://www.theouthousers.com/content/blogcategory/84/163 [R=301,L]

It results in a URL called http://www.theouthousers.com/content...d=25&Itemid=51, which works, but would be best if I could get it to just http://www.theouthousers.com/content...ategory/84/163. Anyone have any ideas?


All times are GMT -5. The time now is 09:08 AM.