Forum Moderators: phranque
I have an old site that was running on PHPnuke. I created a new site based on Joomla to replace the old site. However, I kept the olr site in another directory. I have many dynamic links set up to the old site urls. I am wondering if there is a way to redirect to the new dir, based on the querie strings?
Current site is
www.example.com
Old site is
www.example.com/archive/
The old site article strings all were like so...
http://www.example.com/index.php?name=News (and then different queries)
They are still intact but need to be...
http://www.example.com/archive/index.php?name=News ...
Because the new site is based on a different CMS, I don't have to worry about that same querie coming through for the new articles. So can I redirect any of the old links to this new directory?
Is this possible, and if so how?
Thank you in advance for any help.
[edited by: jdMorgan at 9:25 pm (utc) on Aug. 15, 2006]
[edit reason]
[1][edit reason] Example.com [/edit] [/edit][/1]
I'd suggest:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=([^&]+)
RewriteRule ^index\.php$ http://www.example.com/archive/index.php?name=%1
Here is an example of a basic link URL
http://www.example.com/index.php?name=News&file=article&sid=7978
Basically, I need it to redirect to this
http://www.example.com/archive/index.php?name=News&file=article&sid=7978
But I need it to be dynamically generated.
I hope that helps.
[edited by: jdMorgan at 1:56 pm (utc) on Aug. 18, 2006]
[edit reason]
[1][edit reason] No URLs, please. See Terms of Service. [/edit] [/edit][/1]
Just annotate the URL showing what parts are variables:
Example:
Rewrite /<script>.php?name=<name>&file=<file>&sid=<sid> --> /archive/<script>.php?name=<name_val>&file=<file_val>&sid=<sid_val>
or
Rewrite /<script>.<script_type>?name=<name>&file=<file>&sid=<sid> --> /archive/<script_val>.<script_type_val>?name=<name_val>&file=<file_val>&sid=<sid_val>
Also, the more time I must spend editing posts for TOS violations, the less time I have to answer questions, and many members here won't answer posts with TOS violations in them... Please review the edits made to your posts above. Thanks.
Jim
Well, I hope so... :)
RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=News&(file=[^&]+&sid=[b][^&]+¦catid[/b]=[^&]+)
RewriteRule ^index\.php$ http://www.example.com/archive/index.php [L]
Inportant: Replace the broken pipe "¦" character in the RewriteCond pattern (in the highlighted area) above with a solid pipe character before use (just re-type it); Posting on this forum modifies the pipe character.
As long as the name/value pairs are in the stated order, this should work. If they are not always in the same order, then the solution gets complicated (but still possible).
Jim
It appears the previous ones a re working just fine, but there are multiple queiries for the same article. It looks as if this also exits.
http://example.com/modules.php?op=modload&name=News&file=article&sid=<var>
and it would need to look like this...
http://example.com/archive/modules.php?op=modload&name=News&file=article&sid=<var>
Can I just add another ReWrite Cond and Rule?