Welcome! Log In Create A New Profile

Advanced

[MOD][Updated] SEO friendly url

Posted by fmpwizard 
[MOD][Updated] SEO friendly url
November 05, 2007 11:41PM
[Updated]

This modification goes in your .htaccess file.

It will re-write the urls after you do a search (it does not do categories yet) to make them "nicer".

in the folder where you have your search.php file create or edit your file under the name of ".htaccess"


Note 1: I have my sphider in the search/ folder. SO if you have your folder as www.domain.com/sphider, you will have to replace search for sphider.

Note 2: Also change the domain name, otherwise your searches will end up on my site.

Note 3: replace the htttp for http (I had to do that, othewise, the forum showed urls)
Add these lines

#sphider rewrite
RewriteEngine on

RewriteCond %{QUERY_STRING} ^query=(.*)\&type=(.*)\&results\=(.*)\&search=1$
RewriteRule ^search/search\.php$ /search/%2/%3/%1\.html? [R=301,L]

#More results fix
RewriteCond %{QUERY_STRING} ^query=(.*)&search=1&results=(.*)&domain=(.*)
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/search\.php$ /domain/%2/%3/%1\.html? [R=301,L]
RewriteRule ^domain/(.*)/(.*)/(.*)\.html /search/search\.php\?query=$3&results=$1&domain=$2&search=1&do=1 [L]

#Did you mean?
RewriteCond %{QUERY_STRING} ^query=(.*)\&search=1$
RewriteRule ^search/and/10/search\.php$ /search/and/10/%1\.html? [R=301,L]

#Main search
RewriteRule ^search/(.*)/(.*)/(.*)\.html /search/search\.php\?query=$3&type=$1&results=$2&search=1&do=1 [L]

#Logo
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/(.*)\.png$ htttp://www.fmpwizard.com/search/$2.png [L]
RewriteRule ^domain/[0-9]{2}/(.*)/(.*)\.png$ htttp://www.fmpwizard.com/search/$2.png [L]

#css files
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/(.*)\.css$ htttp://www.fmpwizard.com/search/$2.css [L]
RewriteRule ^domain/[0-9]{2}/(.*)/templates/(.*)\.css$ htttp://www.fmpwizard.com/search/templates/$2.css [L]

#Suggest framework
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/include/(.*)$ htttp://www.fmpwizard.com/search/include/$2 [L]
RewriteRule ^domain/[0-9]{2}/(.*)/include/(.*)$ htttp://www.fmpwizard.com/search/include/$2 [L]

Diego Medina
[url=http://www.fmpwizard.com]Web Developer[/url]



Edited 2 time(s). Last edit at 11/08/2007 06:43AM by fmpwizard.
Re: [MOD] SEO friendly url
November 05, 2007 11:49PM
It is currently not working on my site as I found out there was a problem with the "Did you mean" link.

Please check back later

Diego Medina
[url=http://www.fmpwizard.com]Web Developer[/url]
Re: [MOD] SEO friendly url
November 05, 2007 11:51PM
thanks, i`ll sure keep an eye on this topic!
Re: [MOD] SEO friendly url
November 06, 2007 12:02AM
ok, add this

RewriteCond %{QUERY_STRING} ^query=(.*)\&search=1$
RewriteRule ^search/and/10/search\.php$ /search/and/10/%1\.html? [R=301,L]


right below the line that has

RewriteRule ^search/search\.php$ /search/%2/%3/%1\.html? [R=301,L]

P.S. My site is working again so that you can check it out. If you find any bugs, just post here and I'll work on it as time permits.

Diego Medina
[url=http://www.fmpwizard.com]Web Developer[/url]
Re: [MOD] SEO friendly url
November 08, 2007 01:08AM
[UPDATED]If you have sphider on the root of your domain, use this code

Note: Please remove the extra t in htttp (I did it to avoid the forum formatting that as a url).

This also fixes an error when clicking "More results from..." it was showing an error before.

Enjoy it!

#sphider rewrite
RewriteEngine on

RewriteCond %{QUERY_STRING} ^query=(.*)\&type=(.*)\&results\=(.*)\&search=1$
RewriteRule ^search\.php$ /search/%2/%3/%1\.html? [R=301,L]

#Did you mean fix
RewriteCond %{QUERY_STRING} ^query=(.*)\&search=1$
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/search\.php$ /search/and/10/%1\.html? [R=301,L]

#More results fix
RewriteCond %{QUERY_STRING} ^query=(.*)\&search=1\&results=(.*)&domain=(.*)
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/search\.php$ /domain/%2/%3/%1\.html? [R=301,L]
RewriteRule ^domain/(.*)/(.*)/(.*)\.html /search\.php\?query=$3&results=$1&domain=$2&search=1&do=1 [L]

#Redirect main search
RewriteRule ^search/(.*)/(.*)/(.*)\.html /search\.php\?query=$3\&type=$1&results=$2&search=1&do=1 [L]

#Redirect sphider's logo
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/(.*)\.png$ htttp://www.throughowleyes.com/$2.png [L]
RewriteRule ^domain/[0-9]{2}/(.*)/(.*)\.png$ htttp://www.throughowleyes.com/$2.png [L]

#Redirect the complete Suggest framework
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/include/(.*)$ htttp://www.throughowleyes.com/include/$2 [L]
RewriteRule ^domain/[0-9]{2}/(.*)/include/(.*)$ htttp://www.throughowleyes.com/include/$2 [L]

#Redirect css files
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/(.*)\.css$ htttp://www.throughowleyes.com/$2.css [L]
RewriteRule ^domain/[0-9]{2}/(.*)/templates/(.*)\.css$ htttp://www.throughowleyes.com/templates/$2.css [L]





Alright, that should do it.

Diego Medina
[url=http://www.fmpwizard.com]Web Developer[/url]



Edited 1 time(s). Last edit at 11/08/2007 06:38AM by fmpwizard.
Re: [MOD][Updated] SEO friendly url
November 12, 2007 07:19PM
hi ! thanks a lot for this ! but i still have a problem, it just does not work... is the code right ? i have tried many things but nothing works, can you help me please ? it would be very nice !
Thanks !
Re: [MOD][Updated] SEO friendly url
November 13, 2007 02:48PM
Does your webserver/host provide mod rewrite capabilities?
Re: [MOD][Updated] SEO friendly url
November 13, 2007 03:07PM
hello, yes ! i have tried on my local host and on my online server, and nothing works...

i have put my .htaccess in /www/ and my sphider in /www/search/ and i juste pasted your code (just to try, and then to optimize it with my own url)... but i don't have any change.

Do you have a website where i could see it action ?
thanks a lot for trying to help me

ps: here a example: i have just downloaded a fresh "spider" file, uploaded it in www/search/ and put my (your ?) .htaccess in www/search

http://www.nitrokaine.com/search/search.php

i still do not have url rewriting...



Edited 1 time(s). Last edit at 11/13/2007 03:21PM by jeanv.
Re: [MOD][Updated] SEO friendly url
November 13, 2007 03:36PM
and just to know i have well understood... it means that if make a search for "internet" in my sphider, i will this url:

http://www.mydomain.com/search/search.php?query=internet&search=1

that will appear like this:

http://www.mydomain.com/search/search/1/internet.html

or something like that ? right ?
sorry if my questions seem to be very simple, but i am not an expert ! ;-)
Re: [MOD][Updated] SEO friendly url
November 13, 2007 07:05PM
you can see a working example here

http://www.fmpwizard.com/search

do you have the "AND OR Phrase" options enable on your site?

Diego Medina
[url=http://www.fmpwizard.com]Web Developer[/url]
Re: [MOD][Updated] SEO friendly url
November 13, 2007 09:14PM
hi, have disabled this option, do you think that the problem is that ?
Re: [MOD][Updated] SEO friendly url
May 25, 2008 03:56PM
hi
where do we must put the htaccess please , at the root of the sphider instalation ?
also we must change the word domain and search too ? like here :
RewriteRule ^search/(and|or|phrase)/[0-9]{2}/(.*)\.png$ htttp://www.throughowleyes.com/$2.png [L]
RewriteRule ^domain/[0-9]{2}/(.*)/(.*)\.png$ htttp://www.throughowleyes.com/$2.png [L]

many thanks
Internet Marketing
August 21, 2008 12:23PM
Your blog is very informative. However it is pretty hard task but your post and experienced serve and teach me how to handle and make it more simple and manageable.

Thanks for the tips… Best regards.

http://www.crmandcontactcentre247.com/
Re: [MOD][Updated] SEO friendly url
September 09, 2008 01:15AM
why did you post the SEO url for apache only ?

You got nothing for lighttpd ??

Database contains: 325 sites, 122837 links, 37 categories and 3307500 keywords
http://www.cyberfun.ro/
Re: [MOD][Updated] SEO friendly url
March 28, 2009 02:03PM
for friendly all links: Did you men , keyword , cloudy
---------------------------------------------------------------
change this file:

go to active template » search_results.php
find "DidYouMean"

<a href="<?php print 'search.php?query='.quote_replace(addmarks($search_results['did_you_mean'])).'&search=1'?>">

change it to:


<a href="<?php print '/search/and/10/'.quote_replace(addmarks($search_results['did_you_mean'])).'.html'?>">

--------------------------------------

change all files in keywords and cloud.php [MOD] similar example up.

for show all picture and logo Go to active template:
Example: templates/standard/header.php


change the address for log from src="logo.png" to "/logo.ong"


if another links to templates/standard/footer.php from root change this likns to example: href="terms.php" to href="/terms.php"

-----------------------------------
view ite: http://iran-news.co.cc/

Have a Good time
Ali Lafzi Ghazi From Iran
Re: [MOD][Updated] SEO friendly url
April 09, 2009 07:47AM
any wordpress mod
Re: [MOD][Updated] SEO friendly url
May 05, 2009 12:31AM
Not definition for page number , 404 error !
lex
Re: [MOD][Updated] SEO friendly url
June 04, 2009 05:53PM
thanks tested it and works perfect
Re: [MOD][Updated] SEO friendly url
July 20, 2009 10:00AM
Interesting thought, i completely agree with your perspective...
[url=http://globolstaff.com/]seo[/url]
Re: [MOD] SEO friendly url
July 22, 2009 06:36AM
Hi
Do you have a version for the wordpress sphider plug in

wordpress org extend plugins sphider

add the dot and dashes or search for it
i did not want to post a url
Re: [MOD][Updated] SEO friendly url
June 21, 2012 05:18PM
Your code does not work.
The URLs do not change.
Sorry, only registered users may post in this forum.

Click here to login