Forum Moderators: phranque

Message Too Old, No Replies

Redirect search URL with parameters

redirect, url, search

         

alexanderm

7:48 pm on Sep 4, 2011 (gmt 0)

10+ Year Member



Hello

I have the following problem. Joomla search generates a URL that looks like this:

http://www.mysite.com/Search.html?searchword=someword

a need to be:

http://www.mysite.com/?option=com_search&searchword=someword

How can I correct that in .htaccess, the site is online and I would rather not mess.

Thanks

g1smd

8:39 pm on Sep 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What is the URL that appears in the browser STATUS BAR when you HOVER over the link WITHOUT clicking it?

What is the URL that you want users on the web to see and use when requesting this page?

What is the actual internal server path and filename and parameters needed to access the content (hint: this answer will not contain a domain name)?

These are very precisely worded questions that need three very precisely worded answers exactly in the requested format.

alexanderm

9:46 pm on Sep 4, 2011 (gmt 0)

10+ Year Member



g1smd thanks for your reply.

In essence, it is necessary that link which contain a "search.html?" be modified to contain "option = com_search"

This type of link:

http://www.mysite.com/?option=com_search&searchword=someword 


occurs when I using a search on the site, when I hover over the link without clicking it. It is correct and should be exactly that, internal link is also like that.

In the webmasters tools, I noticed the links like these:

http://www.mysite.com/Search.html?searchword=someword 


which returns an 404 error. Is it possible such links automatically redirect to a version that has "option = com_search" instead "search.html?" ?

Sorry for bad English.

g1smd

10:26 pm on Sep 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can do one of two things:

You can redirect requests for
http://www.example.com/Search.html?searchword=someword
to a different URL like
http://www.example.com/?option=com_search&searchword=someword
and users will see they have been redirected.

You can rewrite requests for
http://www.example.com/Search.html?searchword=someword
such that content is fetched from the internal path at
/index.php?option=com_search&searchword=someword
.

Both are possible - but only for GET requests. You cannot redirect POST requests.

lucy24

12:52 am on Sep 5, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Both are possible - but only for GET requests. You cannot redirect POST requests.

:: detour to [en.wikipedia.org...] ::
Per RFC 2616, the POST method should be used for any context in which a request is non-idempotent: that is, it causes a change in server state each time it is performed, such as submitting a comment to a blog post or voting in an online poll. In practice, GET is often reserved, not simply for idempotent actions, but for nullipotent ones, ones with no side-effects (not simply "no side effects on second or future requests"). For this reason, web crawlers such as search engine indexers normally use the GET method exclusively, to prevent their automated requests from performing such actions.

but, on the other hand, contrariwise,
However, there are reasons to use POST for idempotent requests, notably if the request uses non-ASCII characters or is very long, due to restrictions on URLs – the query string in the GET method may become very long, especially due to percent-encoding.


It's OK, Alexander, I'm getting dizzy too. "idempotent" means something happens at the far end. (For example, you buy stuff or add a blog comment.) "nullipotent" means nothing happens, you just get the page.

I don't remember ever seeing a POST from google. Or anyone else, except the occasional nefarious robot. (Just did a quick search. What does /trackback mean?) But then, I don't have anything that involves query strings ("parameters").

Is joomla adding the "option" etc part in a way that works for humans but not for robots? So google is seeing something that a human would never see?

Fortunately you have another way out, since the problem is specifically with g###. There's an area in gwt where you can tell them to ignore parameters. Neither you nor google want them to index search result pages. (It is not every day that webmasters and google agree ;))