crazylane
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Page permalinks with .html extensionHi Darren131,
This what I did so all uris will end .html
Edit wp-incudes/classes.php
Find the class ‘class WP’ and look for
$req_uri = str_replace($pathinfo, '', $req_uri);
$req_uri = str_replace($home_path, '', $req_uri);
and add this after the above
$req_uri = str_replace('.html', '', $req_uri);This will remove the .html out of uri
Now we add it
Edit wp-includes/template-functions-links.php
Find this
return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post);and edit to look like this
return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post) .'.html';This adds .html to all posts.
Now we can add the .html to all pages
Find this, its down the page about 20 lines
$link = get_page_uri($id);
$link = str_replace('%pagename%', $link, $pagestruct);
$link = get_settings('home') . "/$link/";
Edit it to like:$link = get_page_uri($id);
$link = str_replace('%pagename%', $link, $pagestruct);
$link = get_settings('home') . "/$link.html";Just remove the / and replace with .html, now all pages will end in .html.
Now find function trailingslashit in the page function_formating.php
function trailingslashit($string) {
if ( '/' != substr($string, -1)) {
$string .= '/';
}
return $string;
}
Change the string to
$string .= '.html';Now that will add the .html to the uri for calendar,months, etc
Robert