Advertisement:

Author Topic: Pretty URLs  (Read 2333425 times)

Offline drewactual

  • Sr. Member
  • ****
  • Posts: 884
    • College Football Fan Site CFB51
Re: Pretty URLs
« Reply #7980 on: June 25, 2020, 09:46:19 PM »
I'm not sure if you can use the & in the url
also after adding the new pretty url, did you set it as primary?

you may also have to then go to pretty urls in admin and Run maintenance tasks

as for the Unable to load the 'PrettyUrls error....sounds like it didn't fully install, use the parse and make sure that all edits were done correctly and all files were uploaded to the proper places

i may be mistaken, here, and in the real world you'd be right... but in the wonder land of htaccess rewrites- the ampersand is permissible... the 'actual' URL is not what you see in the address bar- it's been rewritten... so long as the script does what is intended, it will translate it and arrive a person at the intended destination...  this is why every move you make in your htaccess is important- one little mistake or even something out of order, and you can wreck a page.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 51
    • studio five
Re: Pretty URLs
« Reply #7981 on: June 26, 2020, 06:15:03 AM »
My apologies. The ampersand in the screenshot of my revised Pretty URL is a typo. I was emulating the error which was on a different board. Rather than "rushes & sedges" for the Pretty URL it should have been "rushes-sedges". The - not the & is what I typed in the actual error. Apparently though, that function (in the Boards Admin section) cannot or should not be used.

@drewactual, if by dump your cache you mean "Empty the file cache" I have done that.

I am also getting errors such as "Unable to load the 'PrettyUrls.english' language file." and page after page of
   8: Undefined offset: 2
   Apply Filter: Only show the errors from this file
   File: /site_name/Sources/MessageIndex.php
   Line: 50
The code below is line 49 and 50:
Code: [Select]
// 301 redirects
if ((isset($context['pretty']['oldschoolquery']) || $context['pretty']['query_string']['board'] != $context['pretty']['board_urls'][$board]) && $modSettings['pretty_enable_filters'])

I am also seeing, in the various php files, many "warnings" which say "If-Else Statements Must Use Braces"

I checked uninstalling this mod and no error warnings are displayed. Perhaps uninstalling it is the way to go.

Offline drewactual

  • Sr. Member
  • ****
  • Posts: 884
    • College Football Fan Site CFB51
Re: Pretty URLs
« Reply #7982 on: June 26, 2020, 11:26:32 AM »
are you on a shared server?  what version of php?  what are the permissions of the sub-directories and files in the PrettyURL's directory? 

i think you've got a malformed htaccess and i think you've either an incomplete or somehow corrupted install- OR- the permissions have been altered (which is why i ask you about shared server- but it could also have been done by you if you use something like filezilla and don't pay attention when uploading/replacing files).

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 51
    • studio five
Re: Pretty URLs
« Reply #7983 on: June 26, 2020, 01:09:45 PM »
@drewactual
I am presently working on a local installation; IE: the server is a second computer in my studio.
It is on a Linux19.3 box with xampp (lampp) and has PHP 7.3 installed. I do use Filezilla but mostly upload/download files through NerBeans which I use to make alterations, mostly to the theme's CSS file. I think file permissions are okay.
Here is the .htaccess file:
Code: [Select]
# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# https://www.smfhacks.com/prettyurls-seo-pro.php
# .htaccess file generated automatically on: June 8, 2020, 5:09

RewriteEngine on
RewriteBase /gm

# Rules for: actions
RewriteRule ^(agreement|acceptagreement|activate|admin|announce|attachapprove|bookmarks|buddy)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(buddies|calendar|clock|collapse|contact|coppa|credits|deletemsg)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(display|dlattach|editpoll|editpoll2|emailuser|findmember|forum|portal)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(groups|help|helpadmin|im|jseditor|jsmodify|links|jsoption)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(lock|lockvoting|login|login2|mailread|logout|markasread|mergetopics)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(mlist|moderate|modifycat|modifykarma|movetopic|movetopic2|notify|notifyboard)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(notifyannouncements|openidreturn|pm|post|post2|printpage|profile|quotefast)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(quickmod|quickmod2|recent|register|register2|reminder|removepoll|removetopic2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(reporttm|requestmembers|restoretopic|search|search2|sendtopic|smstats|suggest)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(spellcheck|splittopics|stats|sticky|tags|theme|trackip|about:mozilla)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(about:unknown|unread|unreadreplies|verificationcode|viewprofile|vote|viewquery|viewsmfile)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(who|\.xml|xmlhttp|forum)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

# PRETTYURLS MOD ENDS

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,054
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Pretty URLs
« Reply #7984 on: June 26, 2020, 01:22:36 PM »
NetBeans is the issue for "If-Else Statements Must Use Braces"
https://bz.apache.org/netbeans/show_bug.cgi?id=233027

The ad the 'PrettyUrls.english' language file." should like that file is not found in the themes/default/languages folder.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 51
    • studio five
Re: Pretty URLs
« Reply #7985 on: June 26, 2020, 02:52:09 PM »
Thanks @vbgamer,
I didn't know about the NetBeans issue. Good thing I didn't start "correcting" files.
PrettyUrls.english.php file is in the default theme folder. I just copied it to the languages folder of the theme I am using. The broken link works now. And I can change the URL filename on the boards page. However, I get the following errors when I visit pages in the forum:

.../index.php?pretty;board=flora-~-general.0
2: preg_replace_callback(): Requires argument 2, 'preg_replace_callback('/(.{20})/u', '\$1< >', '$1')', to be a valid callback
.../Sources/Subs.php
Line: 4998
.../index.php?pretty;board=forbs.0
2: preg_replace_callback(): Requires argument 2, 'preg_replace_callback('/(.{20})/u', '\$1< >', '$1')', to be a valid callback
File: .../Sources/Subs.php
Line: 4998



Line 4998 is the word "$message);" in the code below:

Code: [Select]
if ($smcFunc['strlen']($message) > $modSettings['TopicSummary_maxwordlength'])
{
// This is done in a roundabout way because $breaker has "long words" :P.
$message = strtr($message, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0"));
$message = preg_replace_callback(
'~(?<=[>;:!? ' . $non_breaking_space . '\]()]|^)([\w' . ($context['utf8'] ? '\pL' : '') . '\.]{' . ($modSettings['TopicSummary_maxwordlength'] + 1) . ',})~e' . ($context['utf8'] ? 'u' : ''),
'preg_replace_callback(\'/(.{' . ($modSettings['TopicSummary_maxwordlength']) . '})/' . ($context['utf8'] ? 'u' : '') . '\', \'\\$1< >\', \'$1\')',
$message);
$message = strtr($message, array('< >' => $breaker, $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;'));
}

Offline Juan Carlos

  • Jr. Member
  • **
  • Posts: 244
  • Gender: Male
Re: Pretty URLs
« Reply #7986 on: June 26, 2020, 05:14:09 PM »
Hi,

I just installed the latest 2.1 gitub version today and when I try to install this mod I have this error.



Juan Carlos

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,054
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Pretty URLs
« Reply #7987 on: June 26, 2020, 06:33:16 PM »
yeah that can happen due to changes will update for rc3
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Juan Carlos

  • Jr. Member
  • **
  • Posts: 244
  • Gender: Male
Re: Pretty URLs
« Reply #7988 on: June 26, 2020, 06:34:52 PM »
ok thanks
Juan Carlos

Offline engrz

  • Full Member
  • ***
  • Posts: 608
  • Gender: Male
  • Engineering and IT Discussion Forum
    • www.facebook.com/engrzpakistan on Facebook
    • @engrz on Twitter
    • Engineering Forum
Re: Pretty URLs
« Reply #7989 on: June 29, 2020, 11:01:50 AM »
Hello,

Im trying to upgrade from 2.1.4b to 2.3 but getting error while upgrading. and i can not uninstall previous mod as there is only option to delete.

can you please guide how to upgrade?

forum url: https://www.engrz.org

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,054
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Pretty URLs
« Reply #7990 on: June 29, 2020, 11:48:27 AM »
I would do manually updates/install the mod over the top of the orignal mod.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline charlie663

  • Semi-Newbie
  • *
  • Posts: 11
Re: Pretty URLs
« Reply #7991 on: July 01, 2020, 11:31:26 AM »
Hi all,
Having Greeny theme, when I install PrettyURL mod in SMF 2.0.17, I can't access to admin menu.

@shadav I think you had a similar problem, didn't you?.

Can you (or anyone else) give me a tip to solve it?

Offline shadav

  • Sr. Member
  • ****
  • Posts: 705
  • Gender: Female
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Pretty URLs
« Reply #7992 on: July 01, 2020, 11:45:36 AM »
Hi all,
Having Greeny theme, when I install PrettyURL mod in SMF 2.0.17, I can't access to admin menu.

@shadav I think you had a similar problem, didn't you?.

Can you (or anyone else) give me a tip to solve it?

I finally figured it out....it's the scrolling-nav.js in the greeny theme

for future reference if someone else uses that theme

fixed it by removing all of the instances of #forum from themes/greeny/index.template.php
and then in themes/greeny/scripts/scrolling-nav.js

find
Code: [Select]
    $("#forum a").not(".dd-selected, .dd-option, .bbc_link").each(function(i){
        var titulo = $(this).attr("href");
            if (this.href.indexOf("#") != -1 || this.href.indexOf("javascript") != -1)
            {
                 $(this).attr("href", titulo);   
            }
             else
            {
               $(this).attr("href", titulo + "#forum");
replace
Code: [Select]
    $("a").not(".dd-selected, .dd-option, .bbc_link").each(function(i){
        var titulo = $(this).attr("href");
            if (this.href.indexOf("#") != -1 || this.href.indexOf("javascript") != -1)
            {
                 $(this).attr("href", titulo);   
            }
             else
            {
               $(this).attr("href", titulo);

now it seems to be working

note that by doing this though it seems to have broken the toTop button of the theme on most pages.....but ;) I'd rather have prettyurls than a scroll to top button
there's also another issue I ran into with the greeny theme creating tons of errors in the logs.....there's a simple fix in the theme's support topic https://www.simplemachines.org/community/index.php?topic=538554.20

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 51
    • studio five
Re: Pretty URLs
« Reply #7993 on: July 01, 2020, 01:33:19 PM »
i was unable to load/display the Pretty URLs template in the admin section. I found out why. I needed to copy it to the theme folder I am using. When I did that I can now access the Pretty URLs Administration page but selecting Enable URL rewriting doesn't work. After saving, it reverts to an unchecked box. And the URLs are not "pretty" they are the basic form: board=___, topic=___.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 51
    • studio five
Re: Pretty URLs
« Reply #7994 on: July 01, 2020, 04:14:54 PM »
So, I went to the database > settings > pretty_enable_filters and changed "0" to "1". Works now.

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,054
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Pretty URLs
« Reply #7995 on: July 02, 2020, 12:48:34 PM »
It seems like something went horribly wrong on install....You shouldn't have had those issues. It looks like the mod did not install fully...
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline drewactual

  • Sr. Member
  • ****
  • Posts: 884
    • College Football Fan Site CFB51
Re: Pretty URLs
« Reply #7996 on: July 02, 2020, 02:22:51 PM »
It seems like something went horribly wrong on install....You shouldn't have had those issues. It looks like the mod did not install fully...

this MAY be an SMF issue... some folks (and i've seen it myself) have reported taking half a dozen times for a setting in admin (ANY setting) to change... i think, personally, it has to do with server settings but i cant' imagine what or where... i thought it was some sort of cache issue for a while, but it's not that.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Pretty URLs
« Reply #7997 on: July 02, 2020, 02:29:47 PM »
You mean like the way the SMF settings table is cached for up to 90 seconds and thus while the new setting is saved, the admin pages are shown using the cached value for that time?
No good deed goes unpunished
All helpful urges should be circumvented

Offline drewactual

  • Sr. Member
  • ****
  • Posts: 884
    • College Football Fan Site CFB51
Re: Pretty URLs
« Reply #7998 on: July 02, 2020, 02:56:27 PM »
You mean like the way the SMF settings table is cached for up to 90 seconds and thus while the new setting is saved, the admin pages are shown using the cached value for that time?

that would be the first time i've heard that explanation... and may very well be 'it'. 

i noticed it way back in 2.0.14 for the first time... adjust setting- save- no change... IF i refreshed the page before trying to save it would usually be saved, but if i didn't and just tried to change and save again it would take several attempts... sometimes it would save instantly... others, it wouldn't- and i don't mean 'after several attempts' i mean it flat wouldn't save it... i'd come back later intent to track cause- try to save, and it would.


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Pretty URLs
« Reply #7999 on: July 02, 2020, 02:59:08 PM »
No, it would save it every time, first time. It just wouldn't show you immediately, because it would be using the stale cache to build the form.
No good deed goes unpunished
All helpful urges should be circumvented