SMFHacks.com

Presales => Presales for Products => Topic started by: drewactual on April 01, 2019, 10:47:07 am

Title: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 01, 2019, 10:47:07 am
Will installing Pretty URL's break links? or, are users still able to reach threads/posts by using the SMF calls even with Pretty URL's installed? 

How much does the function slow a site?

Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 01, 2019, 10:53:30 am
Doesn't break existing links. They will redirect to the original topic/location. For my forums I generally just do rewriting of boards, topics/posts and do not do action rewriting.

It terms of speed it depends on the options selected. You can use the other cache that uses no database calls which makes it quicker for processing its in the pretty urls main settings.

I use the same system on createaforum.com and I have probably 40k forums on one server. Another example site of mine https://www.ezportal.com
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 01, 2019, 11:08:16 am
last weekend i (re)installed mod_pagespeed.   I was loading DOM in well under a second even prior, but pursued the function anyway for the re-writing of images (webp) and lazyloading- as well as collecting and minifying css and js which has about got out of control (i have a main combined and minified js and css which are both sizable and which are h2 pushed to the client PRIOR to the mod_pagespeed re-install)... now the page is about the same speed as it was, but should be more reliant on client cache and optimized output (via pagespeed). 

question:  do you have any sites using mod_pagespeed and pretty url's?  Do they play nicely?  I have SMF's cache at level 2 and the server side zlib turned off, and use memcached... i also use opcache... these don't have any strange conflicts- another of my concerns is pretty url's (and I'm not just about pretty URL's, i'd like to re-purchase the entire SEO suite) will encounter a conflict with mod_pagespeed. 

(contos7;apache2.4 and MPM worker FPM/FastCGI, php7.1; a dedicated server so i can add or remove whatever mod_'s i need to)
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 01, 2019, 11:28:54 am
I don't use mod_pagespeed on my sites. I use apache 2.4 latest smf level 3 cache, I think zlib is off as well. And I use memcached  too

Shouldn't be any conflicts with that module.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 01, 2019, 07:53:18 pm
well, i dumped pagespeed- it was too feeble without over complicating it. 

so this is POST purchase question:  when i install this thing, will it overwrite the existing htaccess?  it's fairly bloated as it is, and to the point i was considering moving it to the httpd.conf instead.....

many thanks, sir. 
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 01, 2019, 07:57:49 pm
Make a backup just in case. Hopefully it shouldn't though.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 02, 2019, 07:30:26 pm
sweet baby james!!! where in the hades is the function for listing Pretty Url's in the Admin menu under configuration?

I'm making certain the older version i have is completely removed before installing the one I just purchased, and i can't find this!!! :)  I've been through every line in the install xml's, and i can't locate this.  everything else is gone........... i hope.

edited: found it.  Admin.php somewhere around line 515
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 02, 2019, 08:42:34 pm
Is it appearing now?
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 02, 2019, 10:45:51 pm
nope... i got it.  i was looking right past it every SINGLE time...

i've cleared all the files so that the installer will work.  man, that old version i had was buried in like a tic.  for whatever reason my site is exceptionally busy for late on a tuesday eve, but as soon as it clears a bit i'm installing...

in the meantime:

Q: i realize now the pages can still be found using the SMF inherit link structure, but.... will the 'new' pages (with pretty URLs) append as 'new' pages on search indexes?  I'm guessing a sitemap may grant me a 'get out of jail free' card if it does, but i'm thinking it'll be better if it doesn't....
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 03, 2019, 07:33:52 am
it's up and running, and doing a great job!!!!

just if anyone else happens along to see this, here are a few things:

- my instance of SMF2.0.15 is highly customized, and i make liberal use of includes into various places.  for whatever reason the include files were okay, but the images within were NOT.... so.... i had to go through them and give a full path to the images (not .././image, but https://image) ... i also had to do the same thing with js and css.  not a big deal- all the time i've spent organizing the site came in handy at this point, and paid off.  in an 'out of the box' instance it should be even easier.

- i found the cache option for pretty url's not a little slower than the db but a LOT.  i reckon YMMV, so- play with it. 

- i WAS on SMF cache level2 with memcached, and i also run OPCache.  with PrettyURL's running atop that, the site's benchmark dropped from an average DOM load of .8seconds to a touch over 3 seconds.  I bumped up to level3 cache and i'm back in the sub-second class again.

AWESOME MOD!!!! many thanks, Sir VBG.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 03, 2019, 10:54:23 am
Thanks give this a shot too. I use this on creataeforum replace the function sources/prettyurls-filters.php
Code: [Select]
// Rewrite the buffer with Pretty URLs!
function pretty_rewrite_buffer($buffer)
{

global $boardurl, $context, $modSettings, $smcFunc;

// Remove the script tags now
$context['pretty']['scriptID'] = 0;
$context['pretty']['scripts'] = array();
$buffer = preg_replace_callback('~<script.+?</script>~s', 'pretty_scripts_remove', $buffer);

// Find all URLs in the buffer
$context['pretty']['search_patterns'][] = '~(<a[^>]+href=|<link[^>]+href=|<form[^>]+?action=)(\"[^\"#]+|\'[^\'#]+)~';
$urls_query = array();
$uncached_urls = array();

if (!isset($context['session_var']))
$context['session_var'] = '';

foreach ($context['pretty']['search_patterns'] as $pattern)
{
preg_match_all($pattern, $buffer, $matches, PREG_PATTERN_ORDER);
foreach ($matches[2] as $match)
{
// Rip out everything that shouldn't be cached
$match = preg_replace(array('~^[\"\']|PHPSESSID=[^;]+|(se)?sc=[^;]+|' . $context['session_var'] . '=[^;]+~', '~\"~', '~;+|=;~', '~\?;~', '~\?$|;$|=$~'), array('', '%22', ';', '?', ''), $match);

// Absolutise relative URLs
if (!preg_match('~^[a-zA-Z]+:|^#|@~', $match) && SMF != 'SSI')
$match = $boardurl . '/' . $match;

// Replace $boardurl with something a little shorter
$url_id = str_replace($boardurl, '`B', $match);

if (substr($url_id,0,7) == 'mailto:')
continue;
if (substr($url_id,0,10) == 'javascript')
continue;

if (substr($url_id,0,11) == 'android-app')
continue;

if (substr($url_id,0,20) == '`B/index.php?action=')
continue;



if ($url_id == '`B/index.php')
continue;


if (substr($url_id,0,7) == 'http://')
continue;

if (substr($url_id,0,8) == 'https://')
continue;

if (substr($url_id,0,18) == '`B/Themes/default/')
continue;

if (strrpos($url_id,'?wap2') !== false)
continue;

if (strrpos($url_id,'upgrades.php') !== false)
continue;
if (strrpos($url_id,'action=') !== false)
continue;

$urls_query[] = $url_id;
$uncached_urls[$url_id] = array(
'url' => $match,
'url_id' => $url_id
);
}
}


// Procede only if there are actually URLs in the page
if (count($urls_query) != 0)
{
$urls_query = array_keys(array_flip($urls_query));
// Retrieve cached URLs
$context['pretty']['cached_urls'] = array();


// If there are any uncached URLs, process them
if (count($uncached_urls) != 0)
{
// Run each filter callback function on each URL
$filter_callbacks = unserialize($modSettings['pretty_filter_callbacks']);
foreach ($filter_callbacks as $callback)
$uncached_urls = call_user_func($callback, $uncached_urls);

// Fill the cached URLs array
// $cache_data = array();
foreach ($uncached_urls as $url_id => $url)
{
if (!isset($url['replacement']))
$url['replacement'] = $url['url'];
$url['replacement'] = str_replace("\x12", '\'', $url['replacement']);
$url['replacement'] = preg_replace(array('~\"~', '~;+|=;~', '~\?;~', '~\?$|;$|=$~'), array('%22', ';', '?', ''), $url['replacement']);
$context['pretty']['cached_urls'][$url_id] = $url['replacement'];

// Cache only the URLs which will fit, but replace $boardurl first, that will help!
//if (strlen($url_id) < 256 && strlen($url['replacement']) < 256)
// $cache_data[] = array($url_id, str_replace($boardurl, '`B', $url['replacement']));
}


}

// Put the URLs back into the buffer
$context['pretty']['replace_patterns'][] = '~(<a[^>]+href=|<link[^>]+href=|<form[^>]+?action=)(\"[^\"]+\"|\'[^\']+\')~';
foreach ($context['pretty']['replace_patterns'] as $pattern)
$buffer = preg_replace_callback($pattern, 'pretty_buffer_callback', $buffer);
}

// Restore the script tags
if ($context['pretty']['scriptID'] > 0)
$buffer = preg_replace_callback("~\x14([0-9]+)\x14~", 'pretty_scripts_restore', $buffer);

// Return the changed buffer.
return $buffer;
}


No database level calls, no caching I just want to see if you see a difference either positive or negative
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 03, 2019, 11:30:22 am
i'll hit that up this eve when the traffic fades.... many thanks once again!
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 05, 2019, 01:42:05 pm
SMF is at my top level directory- i have a publisher function, and a store which are subdirectories... What setting in PrettyURL's do I use to be able to navigate to those directories again?  Currently, it's just cycling back to the boardindex/home page.

I suppose it has something to do with 'skip actions list', but i've not the foggiest how to use it...

and help would be appreciated.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 05, 2019, 01:46:17 pm
For sub directories requires .htaccess change refer to
https://code.google.com/archive/p/prettyurls/wikis/TroubleShooting.wiki
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 05, 2019, 01:50:44 pm
dang, man... I hope you make a lot of money off this enterprise of yours, because you've got your freakin' act together, Sir... Outstanding support on a great product, and many thanks.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 05, 2019, 01:57:43 pm
Off my marketing companies yeah. This site for SMF is mostly for fun the big years were from like 2006 to 2008.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 05, 2019, 02:02:51 pm
well keep it up...

I get humored by folks who believe they can 'turn it on' when they want or when they feel and opportunity approaching only to find out they cannot.  if you 'got' it, it's on 100% of the time in all your endeavors- and this is apparent with your product and the care you give you're afflicted.  it's a blessing and a curse, no?

cheers, Sir.   

Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 06, 2019, 08:27:40 pm
If i move all directives to the httpd.conf file, is this going to put the freak on prettyurls? 

I don't anticipate altering the htaccess again insofar as this mod is concerned... for performance and security reasons, i'm thinking this is something i want to do, but not if it will hurt prettyurls. 
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 06, 2019, 08:47:31 pm
Nah it's fine you can keep in either.
Yeah httpd conf file faster so you can skip .htaccess files.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 07, 2019, 12:32:29 pm
getting 404's after the move of rules to httpd... the URL's work (it exchanges them in address bar), so I' thinking this is something with the mapping and the db?

Is the procedure to simply turn PrettyURL's OFF and then back on?  what am I missing?  ......... it's gotta be simple. 
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 07, 2019, 06:06:14 pm
Hmm you might have to change the rewrite base from my research
https://webmasters.stackexchange.com/questions/81201/returning-404-error-after-using-rewriterule-on-localhost
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 07, 2019, 09:29:48 pm
I'm thinking it has to do with the <directory> and perhaps the base... which should remedy the rewrite rearrangement, no?
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 07, 2019, 10:39:53 pm
Maybe I had an issue on a different system/site a long time ago I not really sure what I did to fix.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 08, 2019, 07:16:09 am
by the way.. My base is already written in the manner offered by the link.  However, I've noticed the offer in the mod's settings to set the 'base', and i have the site's full URL in there...

...If i were to enter "/" instead, what would happen?

I'm thinking it will just look for an htaccess north of the forum's?  Or..... ???

thanks, and I really appreciate the help.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 08, 2019, 07:24:43 am
My default base
RewriteBase /

That works as long as your forum is not in a sub directory.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 08, 2019, 10:49:35 am
i'm befuddled...

the rules work, as they're drafted and implemented into httpd.conf/includes/userdata/blahblahblah directory, and they take affect in the forum (it translates both to and from; e.g. /index.php?mssgid=xxxx OR /prettyboard/prettymessage.. meaning if i approach the page using either of those request after shutting down htaccess it will render with the pretty url, and a not so pretty custom 404.  (not custom through prettyurl's but done server side). 

all other directives in the httpd.conf file are working as expected.

so, it isn't the rewrite that's whiffing.  it's something to do within SMF or the db. 

^entertaining that, I've turned rewrites off using the admin panel, changed the name of htaccess (rendering it useless), turned it back on (and changed the updated htaccess's name to render it useless too) and made certain the code in the system's drafted htaccess matched the code/directives in my httpd.conf, and then dumped the site's cache... and.... no dice.  404's. 

it's the same whether i use cache or db pulls for the function (but I haven't tested your alternative code from a page back yet). 


....... so... here is what i'm going to do, but i'll have to wait until the little hours to pull it off (traffic dies).  This may be a solution for anyone else considering moving from htaccess to httpd.conf exclusively.

Quote
There is a command valid in httpd.conf that allows htaccess to be shut down site wide, but to use a SINGLE additional directive file (you can name it whatever you want, or you can still use the name .htacess if you want)...

I'll keep it titled ".htaccess" with the intent to maintain continuity with the mod specifications/script which looks for that file (to write the rewrites). 

I'll also pull out of the httpd.conf files anything to do with prettyurl's. 

the intent is to retain all the function of htaccess while NOT allowing apache to parse the entire directory tree for other .htaccess's.

in theory, i don't see how this can fail- you still get the benefit of increased performance because it isn't searching public_html (or even above) for htaccess... just that single one. 

thoughts?

Thank you again for your interest in helping me out- and i hope this helps others out too.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 08, 2019, 05:27:10 pm
Yes that's what I do for some sites.
Just parse the one .htaccess for the main site and not any sub directories.
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 08, 2019, 11:46:06 pm
it works like a charm. 

every other rule worked in httpd.conf, just not the various rewrites.... so as i suggested the server is set up to look for ONE htaccess file, and the only thing in that file pertains to prettyurls.  all other rules, again, are from httpd.conf...

however... after all of this was done i had to fix the redirects to the publisher and store- and scratched my head as to why... within that answer is the reason this gave me so much trouble.... option MultiView.  grrrrrr....

it's good now though. 

thanks for your help!!!
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 09, 2019, 11:47:33 am
Glad to help
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: drewactual on April 10, 2019, 12:58:59 am
"skip actions list"... can you give me an example so i can identify the syntax used?  i'm thinking this mod is making alerts cough a bit and that is where to fix it... 
Title: Re: Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads
Post by: SMFHacks on April 10, 2019, 01:17:37 pm
Answered on SMF but solution just the action name itself. For multiple separate with a comma