1. Hack rewrite SEO URLs for XFields (If field as link)

Hack rewrite SEO URLs for XFields (If field as link)

  |   7
Hack rewrite SEO URLs for XFields (If field as link)

Hack rewrite SEO URLs for XFields (If field as link), when you add xfield in your website and want to use different URLs for each xfield like actor, director, year, genre etc. this hack will help you write the new SEO url easily without using third party module, the tutorial will show you to set your own URL based on your xfield name.

Datalife Engine files to modify
- engine/modules/show.short.php (Shortstory)
- engine/modules/show.full.php (Fullstory and relatednews)
- engine/modules/show.custom.php (Custom tag articles and search page on DLE 10.1 and newer)
- engine/modules/topnews.php (Top/Popular articles)
- engine/modules/search.php (Search page - DLE 10.0 and older only)

Datalife Engine 10.2 - 10.3 and newer


Information!You must register before you can view this text. Please register or Login

Find:
Information!You must register before you can view this text. Please register or Login

Replace with:
Information!You must register before you can view this text. Please register or Login

Find

Datalife Engine 10.1


- engine/modules/show.short.php (Shortstory)
- engine/modules/show.full.php (Fullstory and relatednews)
- engine/modules/show.custom.php (Custom tag articles and search page on DLE 10.1 and newer)
- engine/modules/topnews.php (Top/Popular articles)

Find:
Information!You must register before you can view this text. Please register or Login

Replace with:
Information!You must register before you can view this text. Please register or Login

Datalife Engine 10.0 and older


- engine/modules/show.short.php (Shortstory)
- engine/modules/show.full.php (Fullstory and relatednews)
- engine/modules/show.custom.php (Custom tag articles and search page on DLE 10.1 and newer)
- engine/modules/topnews.php (Top/Popular articles)
- engine/modules/search.php (Search page - this file is no need to edit if you are using DLE 10.1 and newer because the search results using show.custom.php)

Find:
Information!You must register before you can view this text. Please register or Login

Replace with:
Information!You must register before you can view this text. Please register or Login

Open .htaccess on your root

Find:
Information!You must register before you can view this text. Please register or Login

Add below:
Information!You must register before you can view this text. Please register or Login

For example:
RewriteRule ^actor/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]
RewriteRule ^country/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]
RewriteRule ^year/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]

where "XFIELD-NAME" is name of xfield and URL to be used

Please note your new URL must be the same as "xfield" name, for example if you add xfield as "actor" then the URL will use "actor" automatically, you can also find the URL from xfield name
[xfgiven_xxx][xfvalue_xxx][/xfgiven_xxx]
or
[xfgiven_actor][xfvalue_actor][/xfgiven_actor]

but if you name your xfield as "star" then your new URL will be automatically used
http://site.com/star/STAR-NAME/
RewriteRule ^star/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]

The rewrite will replace the Latin name for "xfsearch" according to additional field name. So if you use "[xfgiven_star][xfvalue_star][/xfgiven_star]" but want the URL to be
http://site.com/actor/STAR-NAME/
RewriteRule ^actor/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]

In this case it won't work because your xfield name is not match

In "XFields Manager" in admin CP, you must set "Use the field values as hyperlinks" check box is selected to be able to get URL to work.

This hack will not include if you have multiple pages like
http://site.com/actor/STAR-NAME/page/2/
http://site.com/actor/STAR-NAME/page/3/
http://site.com/actor/STAR-NAME/page/4/
...

The URLs will be using default "xfsearch" URL as default, hopefully we have some expert to finish this hack for multiple pages.

I know the code to fix this hack in in /engine/engine.php in the line
Information!You must register before you can view this text. Please register or Login

But I have no idea to replace and rewrite all automatically...so if anyone knows how to fix this then please share...

All Russian websites gave the code
Information!You must register before you can view this text. Please register or Login

But I don't think they know about this issue, they just assume it will work, I don't think anyone care to test and check the real world with multiple pages, my guess is they copy and copy from another sites...this is very sad because no one knows where the original articles are written from, it's bad habit that they seem to make articles like their own articles...stupid DLE communities seem to be this way on every website... nini

Source: http://www.dle9.com/haki/3756-dlya-lyuboy-versii-dle-hak-dop-polya-po-kategoriyam.html
Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.

Details

+6

Comments 7

DLEStarter
DLEStarter
DLE TEAM
Commented By DLEStarter on December 15, 2014 (6:49 pm)
Quote: alx974
Not work for me on DLE 10.2 :/

I just fully tested it with DLE 10.2, it's absolutely 100% guarantee working...

The test site can be found at:
http://demo102.dlenewbie.com/year/2014/
29 225Forum topics : 9Forum replies : 558Forum likes : 116
winson
winson
Members
Commented By winson on May 30, 2015 (5:17 pm)
Great Jobs.. It works well...:)
N/A 5Forum topics : 3Forum replies : 6Forum likes : 0
sri
sri
Members
Commented By sri on June 2, 2015 (6:52 am)
hi yorismith

how to modify this hack in dle 10.4..

not working dle 10.4 in my localhost..

thanks
N/A 19Forum topics : 12Forum replies : 36Forum likes : 1
DLEStarter
DLEStarter
DLE TEAM
Commented By DLEStarter on June 2, 2015 (10:28 pm)
Quote: sri
how to modify this hack in dle 10.4..

not working dle 10.4 in my localhost..

absolutely 100% working on localhost. the only possible problem you may have is your localhost on Microsoft Windows machine will not properly setup to accept / since / will take your localhost directly to http://localhost/ instead of your actual site URL, so the question is how did you setup your localhost? if you set localhost as your main URL then you set your site to http://localhost/something/link/to-xfield/ then it will always taking you to http://localhost/ instead, in this case it's not problem with this hack because you have no idea what's localhost in windows computer

or unless you don't set xfield to use "Use the field values as hyperlinks" otherwise forget it, you will never get it to work
- localhost file list )http://localhost/demo104/ : http://i60.tinypic.com/9tz8sl.jpg
- show.short.php: http://i62.tinypic.com/124bqdc.jpg
- topnews.php: http://i58.tinypic.com/2vikrd5.jpg
- show.custom: http://i59.tinypic.com/mjsb3t.jpg
- show.full.php: http://i58.tinypic.com/33wsbwo.jpg
- xfields.txt: http://i62.tinypic.com/4glvg2.jpg
- XField Manager Settings: http://i59.tinypic.com/34fitzr.jpg
- .htaccess: http://i58.tinypic.com/6fbc47.jpg
- .htaccess add tags: http://i58.tinypic.com/2vx222q.jpg
- shortstory.tpl html code: http://i57.tinypic.com/357gaqx.jpg
- fullstory.tpl html code: http://i61.tinypic.com/30bzm13.jpg

Everything is working fine and I get url
http://localhost/demo104/director/michael+bay
http://localhost/demo104/stars/mark+wahlberg
http://localhost/demo104/country/usa
http://localhost/demo104/year/2014

This is WAMP server on Windows 7 Ultimate x64
29 225Forum topics : 9Forum replies : 558Forum likes : 116
sri
sri
Members
Commented By sri on June 3, 2015 (2:30 am)
hi DLEStarter

yes, now working good,

thanks
N/A 19Forum topics : 12Forum replies : 36Forum likes : 1
onchannel
onchannel
V.I.P.
Commented By onchannel on February 21, 2016 (11:47 am)
not working on 10.5 :(
N/A 84Forum topics : 8Forum replies : 14Forum likes : 0

full movies
viatech
viatech
Members
Commented By viatech on June 23, 2016 (5:56 am)
there is an error occur to me what will do

Warning! An error was detected
Publications at this address of the website are not found or you do not have permissions to view the information at this address.
N/A 1Forum topics : 1Forum replies : 1Forum likes : 1
Information!Would you like to leave your comment? Please Login to your account to leave comments. Don't have an account? You can create a free account now.
DLEStarter Notice!Please note...Every hack and every module will get additional queries from your database and some hacks and some modules may result your server overload, so install only what you "need", remove any hacks and modules from your script when you don't need them, all hacks and modules appears in this website are not guaranteed by DLEStarter Team for your script security and compatibility, please read instruction carefully and use hacks and modules at your own risk...Thank you.