GetSimple Support Forum
.html in url - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Off Topic (http://get-simple.info/forums/forumdisplay.php?fid=12)
+--- Thread: .html in url (/showthread.php?tid=437)



.html in url - kotos - 2010-02-26

anyone know how to add for all urls in gest simple .html at end of url
ex.
www.getsimple/page1.html
www.getsimple/page2.html


.html in url - kirillaristov - 2010-02-27

My solution only works if you are using single-level navigation, I have tested it in GetSimple v2.0
For first you must enable pretty urls in admin -> settings,
then edit admin/inc/theme_functions.php, lines 359-360, replace with it:
Code:
if ($url_nav == 'index' ) $url_nav = ''; else $url_nav .= '.html';
$menu .= "<li class=\"$classes\"><a href=\"{$SITEURL}{$url_nav}\" title=\"$page[title]\">$page[menu]</a></li>\n";
Then edit .htaccess file in the root of your site:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([A-Za-z0-9-]+)\.html/?$ index.php?id=$1 [L]



.html in url - kirillaristov - 2010-02-27

I recommend remove link to main page from menu when current page is main.
(/admin/inc/theme_functions.php, lines 365-371)
Code:
if ($url_nav == 'index' and $currentpage == 'index')
    $full_nav = "<li class=\"index current\">$page[menu]</li>";
else {
    if ($url_nav == 'index') $url_nav = '';
    $full_nav = "<li class=\"$classes\"><a href=\"{$SITEURL}{$url_nav}\" title=\"$page[title]\">$page[menu]</a></li>";
}
$menu .= $full_nav;

After it need to change theme css to restore old view.


.html in url - Zegnåt - 2010-02-28

kirillaristov Wrote:Then edit .htaccess file in the root of your site:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([A-Za-z0-9-]+).html/?$ index.php?id=$1 [L]

I did not care to test it, but it doesn’t sound like it will work. The regular expression seems not to match child pages at all. Besides that I would recommend you remove the final /? before the $. If you want it to “fake” a normal HTML page it should never be followed by a slash.

kirillaristov Wrote:I recommend remove link to main page from menu when current page is main.
The only reason you would do this is if you do not want to have any self-links. In which case it goes for all pages, not just the main page. So I wouldn’t put much thought in it or make an if-clause that tests for all.

My 2¢