Posts: 1
Threads: 1
Joined: Mar 2010
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
Posts: 972
Threads: 27
Joined: Aug 2009
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
2010-03-18, 04:00:27
(This post was last modified: 2010-03-18, 04:01:29 by fotothink.)
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)
Posts: 1,204
Threads: 30
Joined: Jun 2010
2010-11-03, 10:45:01
(This post was last modified: 2010-11-03, 10:55:20 by BlackRose.)
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
Addons: blue business theme, Online Visitors, Notepad
Posts: 3,491
Threads: 106
Joined: Mar 2010
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):
(GS 2.03+, of course)
Posts: 1,204
Threads: 30
Joined: Jun 2010
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.
Addons: blue business theme, Online Visitors, Notepad
Posts: 3,491
Threads: 106
Joined: Mar 2010
Sorry yojoy, I should have said: you can use custom permalinks instead of patching basic.php
Posts: 1,204
Threads: 30
Joined: Jun 2010
2010-11-03, 23:12:41
(This post was last modified: 2010-11-04, 04:10:52 by BlackRose.)
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
Addons: blue business theme, Online Visitors, Notepad
Posts: 3,491
Threads: 106
Joined: Mar 2010
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.
Posts: 1,204
Threads: 30
Joined: Jun 2010
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
To summarize, there are 2 ways to set own permalink structure. Both need a small change in .htaccess - at least for me.
Addons: blue business theme, Online Visitors, Notepad
Posts: 3,491
Threads: 106
Joined: Mar 2010
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)
Posts: 1,204
Threads: 30
Joined: Jun 2010
2010-11-04, 08:12:01
(This post was last modified: 2010-11-04, 08:30:12 by BlackRose.)
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
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.
Addons: blue business theme, Online Visitors, Notepad
|