Forum Moderators: phranque
Can somebody please help me to rewrite variables from:
mysite.com/index.php?option=com_sobi2&tag=someword
to
mysite.com/Search.html?searchword=someword
So this part from the middle "index.php?option=com_sobi2&tag="
should be replaced with this one "Search.html?searchword="
I'm a newbie so please be specific.I have some 1500 URLs to rewrite like this.
What exactly should I put in my htaccess file?I tryed something on my own,but it just doesn't work...
Thanks in advance.
What have you tried already?
This forum can help you fix your code, but as most people here have jobs to be getting on with elsewhere, this isn't an unpaid code-writing service.
If it is to be a redirect you will need the full domain name in the target URL, and will end with [R=301,L]. You'll need a RewriteCond to look at QUERY_STRING too.
For a rewrite, omit the domain name and end the rule with [L].
Which URL are you linking to from your pages? Which URL should be be seeing and using to access the content? What is the local filepath inside the server for where the content really resides?
Normally I just beat my head on the wall when dealing with Joomla! sites. It has a very large bucketful of Dupe Content issues.
[edited by: g1smd at 2:27 am (utc) on Mar. 17, 2009]
mod_rewrite in use
RewriteEngine On
RewriteRule ^(/?tag=)/?$ search.html?searchword=$1 [QSA,L]
There is one more thing.I need to replace & character with + in query string append in order to get this to work.
Again,I'm so sorry but I just can't get much better than that...
This is about Joomla site.
[edited by: Mark33 at 2:34 am (utc) on Mar. 17, 2009]
The question is therefore this... do you want to retain the old URLs as previously used by Joomla while switching to some new CMS that works differently to Joomla on the inside OR do you want to continue to use Joomla but change the URL format that users will see and use when they access the site?
Depending on the answer, it is possible that the rewrite needs to work in exactly the opposite direction to the example code posted immediately above.
g1 I'm not trying to migrate.What I'm trying to do is to make search strings from tags.Let me explain...
I use sobi2 component which is great great component,by the way.When I enter article,I enter meta keywords for that article as well.Sobi2 makes tags out of this meta keywords.
The problem is that those tags are just making loop back to same article too often,so they are almost useles.Even worse,sometimes all tags from article are just making loop back to same page.
So,I'm trying to mage search strings out of that tags,and bring some functionality to my site,and not being penalized by Google any more.
I get around 4000 unique visitors from Yahoo,but only around 300 from Google,and I think this might be the reason.We all know what Google thinks about two or more urls leading to same content.
My full urls look like this:
[mysite.com...]
to:
[mysite.com...]
So I need to rewrite all urls in way which replaces ?tag with Search.html?searchword.
I use SH404 SEF component,but those urls (tags) are untouched.
Input pattern from the requested URL is to be found from the
QUERY_STRING by looking at tag=(.*) Internal server filepath target is
/Search.html?searchword=%1 A simple rewrite may be all you need here, as long as Search.html is a real physical file on the server, and can run scripts.
[edited by: g1smd at 9:35 pm (utc) on Mar. 20, 2009]
First, "Search.html" starts with an uppercase "S".
Second, it is very unlikely that "Search.html" is a real file. And if it is, then it won't accept query strings, because HTML files don't require or accept query strings.
There is probably a piece missing here, but the code I posted does exactly what was asked for.
Jim
I can asure you that nothing is missing in those urls.They both work.First one is leading to the article(along with one more tag and "normal" article URL).
Second url is working too and it performes a standard joomla search.
I'm not sure why Search starts with uppercase letter,but I think SEF componet is to blame.
[edited by: Mark33 at 10:24 pm (utc) on Mar. 20, 2009]