Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-06-11 18:56:28

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

appending .html to article urls

is there an easy mod to the .htaccess file to make article urls end in .html ?

Offline

#2 2007-06-11 19:00:29

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: appending .html to article urls

I know it is possible because the new PunBB was going to do this.

Offline

#3 2007-06-11 19:29:06

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: appending .html to article urls

Using mod_rewrite in .htaccess you can strip the .html part to textpattern understands it.
You’d have to modify /textpattern/publish/taghandlers.php to make the permlinkurl function add the .html part.

Offline

#4 2007-06-11 19:35:51

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: appending .html to article urls

FireFusion wrote:

I know it is possible because the new PunBB was going to do this.

As far as I know, there’s no way to modify outgoing links by any directive in .htaccess. To modify the URLs Textpattern produces to link to articles you’ll have to change the built-in behaviour of Textpattern, e.g. via a plugin. Try Graeme’s.

Offline

#5 2007-06-11 19:46:08

lux0r
New Member
Registered: 2007-05-23
Posts: 6

Re: appending .html to article urls

how does this look :

original :

switch($permlink_mode) {

case ‘section_id_title’:

if ($prefs[‘attach_titles_to_permalinks’])

{

return hu.”$section/$thisid/$url_title”;

}else{

return hu.”$section/$thisid/”;

}

case ‘year_month_day_title’:

list($y,$m,$d) = explode(“-”,date(“Y-m-d”,$posted));

return hu.”$y/$m/$d/$url_title”;

case ‘id_title’:

if ($prefs[‘attach_titles_to_permalinks’])

{

return hu.”$thisid/$url_title”;

}else{

return hu.”$thisid/”;

}

case ‘section_title’:

return hu.”$section/$url_title”;

case ‘title_only’:

return hu.”$url_title”;

case ‘messy’:

return hu.“index.php?id=$thisid”;

}

CHANGE TO :

switch($permlink_mode) {

case ‘section_id_title’:

if ($prefs[‘attach_titles_to_permalinks’])

{

return hu.”$section/$thisid/$url_title.html”;

}else{

return hu.”$section/$thisid/”;

}

case ‘year_month_day_title’:

list($y,$m,$d) = explode(“-”,date(“Y-m-d”,$posted));

return hu.”$y/$m/$d/$url_title.html”;

case ‘id_title’:

if ($prefs[‘attach_titles_to_permalinks’])

{

return hu.”$thisid/$url_title.html”;

}else{

return hu.”$thisid/”;

}

case ‘section_title’:

return hu.”$section/$url_title.html”;

case ‘title_only’:

return hu.”$url_title.html”;

case ‘messy’:

return hu.“index.php?id=$thisid”;

}

Am I missing anything? I have tried it out and seems to work with no errors. Im just afraid of problems down the line.

Last edited by lux0r (2007-06-11 19:47:43)

Offline

#6 2007-06-11 19:57:02

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: appending .html to article urls

Looks okay. You’ll just have to remember to make that change on each TXP upgrade.

Offline

#7 2007-09-10 21:12:01

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: appending .html to article urls

is there a way to append .html to section urls.

instead of example.com/sec-1 , have example.com/sec-1.html ?

Offline

#8 2007-09-11 08:06:50

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: appending .html to article urls

just out of curiosity: why would one do that?

Offline

#9 2007-09-11 10:43:28

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: appending .html to article urls

hm… I made it easier – just add desirable article name while editing :) For ex. – article name – “example.html” :) But the only “bug” is that when you enter category list or start section page it doesn’t load any article by default and the url doesn’t contain “html” :)


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#10 2007-09-11 17:26:01

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: appending .html to article urls

sven: for seo purpose, would like the section url to end in .html instead of being a folder.

victor: i have no clue of what you mean

Offline

#11 2007-09-11 17:36:02

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: appending .html to article urls

If it doesn’t end with a slash, it’s not a folder.
Victor is referring to the advanced options on the write tab, where you can modify the article_url_title.

Offline

#12 2007-09-11 17:48:01

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: appending .html to article urls

im not sure which code in tag_handler.php writes the section urls, if i knew which code block did this i can try to add .html to it. do you know which code it is?

Offline

Board footer

Powered by FluxBB