GetSimple Support Forum
Change page urls to include .html - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Change page urls to include .html (/showthread.php?tid=550)



Change page urls to include .html - hitankar - 2010-03-17

Hi,

I am new here. I am not sure if I am to post it here.

Is there a way to include a .html after each page. So, that

Code:
http://www.example.com/page/

would be

Code:
http://www.example.com/page.html

I made the changes in the .htaccess. But I was need to make changes from within the cms, to make this work.

Is there any way?

Please let me know.

Thanks.

Ray


Change page urls to include .html - Zegnåt - 2010-03-18

My first thought is indeed that you’ll need to change the .htaccess to support this. The next step would be to change the find_url() function to make sure it includes .html when generating page URLs.

You’ll find find_url() in /admin/inc/basic.php.


Change page urls to include .html - Carlos - 2010-03-18

The "#" (view) link in the Page editor, line 72 (in GS 2.01) of admin/pages.php, should also be changed to add the .html string.

Maybe this part of the code should use find_url() ...?

(BTW, found this because I'm trying to make GS use a last trailing slash on fancy url pages -- I prefer that as I agree with this old post)


Change page urls to include .html - yojoe - 2010-11-03

Sorry for necroing the thread, but could you give me a hint what else do I have to change to have .html at the end of links ?
in /admin/inc/basic.php I changed line 366 to $url = $full . $parent . $slug . '.html';
but I have no idea where should I look, nor what should I change to force the pages to be saved with .html extension in file names.

edit: ohhh I always find a solution right after I submit a post :|

second thing needed to be change is to edit .htaccess RewriteRule to
RewriteRule ([A-Za-z0-9-]+).html index.php?id=$1 [QSA,L]
and we have a nice .html for parents and slugs Smile


Change page urls to include .html - Carlos - 2010-11-03

Besides .htaccess, another thing to do: set custom permalink structure to:
Code:
%parent%/%slug%.html

or (if you don't want the parent's slug in the URL):

Code:
%slug%.html

(GS 2.03+, of course)


Change page urls to include .html - yojoe - 2010-11-03

Just tested again if setting custom permalink in panel is a must.
To have .html at the end in GS 2.04ß custom permalinks doesn't need to be set.

I'll try to see if they're needed in 2.03 later.


Change page urls to include .html - Carlos - 2010-11-03

Sorry yojoy, I should have said: you can use custom permalinks instead of patching basic.php


Change page urls to include .html - yojoe - 2010-11-03

ehh, it's always easier for me to edit source code, than use built in options.
I used %parent%.html and %parent%.html/%slug%, and since it didn't work, I messed with code and mod rewrite.

I like this CMS very much, but for quite some time I see it tries to make my life difficult.

edit: setting custom permalink like %parent%/%slug%.html still needs to update mod rewrite rule


Change page urls to include .html - Carlos - 2010-11-04

yojoe,

The structures you used cannot work, they're not correct.

I've tested (in GS 2.03 and beta 2.04) your .htaccess RewriteRule with the two custom permalink examples I posted on message 5, and they work ok!

I've done another test: changing ".html" to ".php" in both .htaccess and the custom permalink examples, and it also works. (".htm" should also do, of course)

PS Thanks for sharing your .htaccess patch! This may be very useful.


Change page urls to include .html - yojoe - 2010-11-04

Tell me what sort of magic are you mastering ? :|

Just tried to test custom plinks in 2.03, and setting own link structure in admin panel to example
%parent%/%slug%.html
%parent%/%slug%.php
%parent%/%slug%.whatever
without change in rewrite rule doesn't work, and every page I visit leads to
Quote:Oops! Page not found!
We are sorry, but the page you are looking for does not exist.
I thought that resaving a page would make it working, but even with creating a new testpage I get "Oops!" :[

It doesn't even matter anymore, after I found a working solution Wink
To summarize, there are 2 ways to set own permalink structure. Both need a small change in .htaccess - at least for me.


Change page urls to include .html - Carlos - 2010-11-04

No magic :-D
Of course you have to edit the rewriterule to match the permalink structure -- it won't work if you don't.

.html
====
Permalink:
%parent%/%slug%.html or %slug%.html
.htaccess:
RewriteRule ([A-Za-z0-9-]+).html index.php?id=$1 [QSA,L]

.php
====
Permalink:
%parent%/%slug%.php or %slug%.php
.htaccess:
RewriteRule ([A-Za-z0-9-]+).php index.php?id=$1 [QSA,L]

Other extensions (besides ".htm") will probably not work (unless they're supported by the server)


Change page urls to include .html - yojoe - 2010-11-04

Carlos Wrote:No magic :-D
Of course you have to edit the rewriterule to match the permalink structure -- it won't work if you don't.

Other extensions (besides ".htm") will probably not work (unless they're supported by the server)

Hah, that explains everything. I'm just tired fighting with GS to force some plugins to work.

btw. every extension/phrase/string you use should work, except special chars.
Tested earlier with .whatever Wink

edit: wait a second. Seems that GS 2.03 doesn't need the change inside .htaccess while 2.04ß needs it. GS wants to trick me all the time.