Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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
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
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
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
Re: appending .html to article urls
just out of curiosity: why would one do that?
Offline
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
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