SMFHacks.com

Modifications/Themes => General SMF Forum => Pretty Urls => Topic started by: SMFHacks on July 13, 2018, 04:24:23 pm

Title: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on July 13, 2018, 04:24:23 pm
If you're experiencing problems with Pretty URLs this page may help you. But first check that your forum is using the latest version of this mod.

Every link causes 404 Not Found errors
If after installing the mod every link is broken, there is probably a problem with your server (it may not support mod_rewrite or per-directory .htaccess configuration files). To fix the links so that the problem can be diagnosed and fixed, or so you can uninstall the mod, create a new .php file with this code:

Code: [Select]
<?php require_once(dirname(__FILE__) . '/SSI.php'); updateSettings(array('pretty_enable_filters' => '0')); ?>
Upload the file to the same location as your forum's SSI.php and open it with your web browser. Then don't forget to delete it!

Links point to old domain after moving forum or fix HTTPS
This is very simple to fix, in addition to updating all the other settings with repair_settings.php, this mod has one more setting to fix. You can either manually fix the pretty_root_url setting yourself, or else create a new .php with this code:
Code: [Select]
<?php require_once(dirname(__FILE__) . '/SSI.php'); require_once($sourcedir '/Subs-PrettyUrls.php'); updateSettings(array('pretty_root_url' => $boardurl)); pretty_update_filters(); ?>
Upload the file to the same location as your forum's SSI.php and open it with your web browser. Then don't forget to delete it!

Sub-directories can't be opened
If you have a sub-directory in your forum directory you will no longer be able to access it as SMF will think you want to open a board with its name (note if you refer to a page in that sub-directory it will work fine.) With one addition to your .htaccess file you can fix this. You may have to change your FTP client's settings in order to see the hidden .htaccess file. This example is for the sub-directory /chat/, which should open /chat/index.html; add it to the top of your .htaccess file (outside the Pretty URLs section!)

Code: [Select]
RewriteRule ^chat/?$ /chat/index.html [L,QSA]
Title: Re: prettyurls - TroubleShooting.wiki
Post by: alitech on October 05, 2019, 09:15:28 pm
Hi there

Thanks for this great package. I am very new to SMF so trying everything out including getting the site to be more SEO friendly. Upon installing this package for 2.1 RC2. I am coming across the 404 errors across the whole site. I have of course fixed it with the php file as advised.

The issue is that my host reports that mod_rewrite is enabled but it never works. I asked them to look further into this and they came back and said that modsecurity had been enabled for my domain and they have now disabled. Its still not working. I have gone back to them again but I was wondering if anyone here can shed light on anything else that should be checked to ensure that mod_rewrite works.

I have almost given up on this. I am on a host that uses cpanel which apparently has mod_rewrire on by default.

Is there anything else I should be checking?

Many thanks.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 08, 2019, 10:48:27 pm
Make sure .htaccess file has the pretty urls listed inside it as well.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: Rock Lee on October 09, 2019, 05:49:30 pm
I do not know if it is the site but I have a query since when reading and applying what it says above the problem was solved however sometimes it marks me:

Code: [Select]
https://www.bombercode.net/foro/index.php?action=prettyurls;sa=error;page=404
8: Undefined index: REQUEST_URI
Archivo: /public_html/foro/Sources/PrettyUrls.php
Línea: 727

The line that marks me is $row['body'] = str_replace("%filename",$_REQUEST['REQUEST_URI'],$row['body']); but if you access this url, it visualizes it as it should be ... Can it be due to the configuration used in my accommodation?


Regards!
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 09, 2019, 07:12:33 pm
Could be empty if you running a cmd via cron job or manually php via cli

https://stackoverflow.com/questions/48579283/when-request-uri-can-be-empty
Title: Re: prettyurls - TroubleShooting.wiki
Post by: Rock Lee on October 10, 2019, 11:37:09 am
Could be empty if you running a cmd via cron job or manually php via cli

https://stackoverflow.com/questions/48579283/when-request-uri-can-be-empty

I will look at it thank you very much! ;D


Regards!
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 12:12:02 pm
Hello!

I am running SMF version: 2.0.17

And I am trying to install Pretty URLs 2.3 (replacing Pretty URLs 1.1.3)

Trying to do this via the package manager generates the following error:

Code: [Select]
Database Error

Specified key was too long; max key length is 1000 bytes
File: /home/forteana/public_html/ghosthuntingforum.co.uk/Packages/temp/SMF2-0/install.php
Line: 39

After multiple failures at getting this to work, I tried to just reinstall Pretty URLs 1.1.3, but that now generates the same error.

I have tried several things to try and fix this, like deleting some tables from the database to try and recreate them, but nothing I have tried has worked.

Any help gratefully received!
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 12:32:50 pm
That's odd...Drop the pretty_urls_cache table from the database.
The max size would be 255...not sure how they get 1000
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 12:41:53 pm
Drop the pretty_urls_cache table from the database.

I tried that already, and it didn't work I am afraid.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 12:45:21 pm
You can remove the the primary line call array('type' => 'primary', 'columns' => array('url_id')), for  the index in the code....but that will cause major slowdowns if your forum gets big....
Code: [Select]
// Create the pretty_urls_cache table
$smcFunc['db_drop_table']('{db_prefix}pretty_urls_cache');
$smcFunc['db_create_table']('{db_prefix}pretty_urls_cache', array(
array('name' => 'url_id', 'type' => 'varchar', 'size' => 255),
array('name' => 'replacement', 'type' => 'varchar', 'size' => 255),
), array(
array('type' => 'primary', 'columns' => array('url_id')),
), array(), 'overwrite');
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 12:46:59 pm
Links what I read go near the bottom of comments https://dba.stackexchange.com/questions/49913/specified-key-was-too-long-max-key-length-is-1000-bytes-in-mysql-5-6
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 12:53:23 pm
....but that will cause major slowdowns if your forum gets big....


Yeah, I don't want to deviate from any mods normal operation if I can help it, it will just cause more problems later.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 02:53:48 pm
Links what I read go near the bottom of comments https://dba.stackexchange.com/questions/49913/specified-key-was-too-long-max-key-length-is-1000-bytes-in-mysql-5-6

I must confess that most of this database stuff is Greek to me.

When I try and install the mod it creates the pretty_topic_urls table just fine, but it won't create the pretty_urls_cache table for some reason? I don't know if that helps?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 02:56:26 pm
Try to run this via phpmyadmin on your database
Code: [Select]
CREATE TABLE `smf_pretty_urls_cache` (
  `url_id` varchar(255) NOT NULL,
  `replacement` varchar(255) NOT NULL,
  PRIMARY KEY (`url_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 03:17:23 pm
Try to run this via phpmyadmin on your database
Code: [Select]
CREATE TABLE `smf_pretty_urls_cache` (
  `url_id` varchar(255) NOT NULL,
  `replacement` varchar(255) NOT NULL,
  PRIMARY KEY (`url_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

Running the above query successfully creates the table, trying to install the mod then deletes it, or at least, when I try to install the mod after creating that table, it disappears?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 03:35:09 pm
Yeah it does you will need to download the mod unzip it.
Find smf2.0/install.zip
and remove this code from it. then rezip it back up.
Code: [Select]
// Create the pretty_urls_cache table
$smcFunc['db_drop_table']('{db_prefix}pretty_urls_cache');
$smcFunc['db_create_table']('{db_prefix}pretty_urls_cache', array(
array('name' => 'url_id', 'type' => 'varchar', 'size' => 255),
array('name' => 'replacement', 'type' => 'varchar', 'size' => 255),
), array(
array('type' => 'primary', 'columns' => array('url_id')),
), array(), 'overwrite');
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 03:47:45 pm
You did it!!! It works!!!

Thank you so much!!!
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 03:49:44 pm
Glad you have it working! Still a strange issue.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 03:54:08 pm
I have several other SMF installs, how do I upgrade from the old version of Pretty urls to the new version? Is there tutorial somewhere?

Thanks again for your help!
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 04:07:11 pm
Ideally you uninstall old version then install new when possible.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: GhostHunting on September 22, 2020, 04:10:45 pm
That gives:

Code: [Select]
HTTP ERROR 500
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on September 22, 2020, 04:24:47 pm
On uninstall That would be tricky. But most of the updates where just the changes from the sources file.
You can do the replacements just overwrite old files. I would do a backup first
Title: moved host old db having pretty url data how to add mod in new installation
Post by: s10dulkar on December 08, 2020, 12:56:45 pm
moved to new host installed fresh smf and reloaded old db now i am trying to enable pretty url as its already in db. but it gives me error when i try and install mod

Specified key was too long; max key length is 1000 bytes
File: /home/customer/www/samplesite.com/public_html/Packages/temp/SMF2-0/install.php
Line: 39

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.17, while your database is at version 2.0.10. The above error might possibly go away if you execute the latest version of upgrade.php.

what to do now? where can i find upgrade.php and will that solve this issue ?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on December 08, 2020, 12:58:49 pm
Replied on smf forum upgrade.php
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 25, 2021, 10:07:01 am
Hello,

I installed pretty urls in a new forum and looks like it is causing me problems.

I ran the maintenance and now it put me out of the admin panel, and I can't access any other pages, only the Home page and boards. Before I saw also an error saying that someone was trying to login as admin, and it was me, I needed to log out as member, and then login and I could access the admin. Then when the time passed, and I needed to login again as admin, it was saying the password was false.

And then like I said above, I can't access the admin panel.

How can I uninstall the Mod manually on my server?

Usually on download page on SMF, there is  a list of files a mod installs, and a list of code it changes in several SMF files. Where do you have it?

Another question related with what another member here posted.     

Quote
make certain and have "index.php?board=" 'allowed' in your robots.txt.

Do you know exactly the code I need to add on my robots.txt file to allow "index.php?board="?

Thanks
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 25, 2021, 10:47:57 am
on my phone but upload package to https://www.smfhacks.com/smf-package-parser.html to reverse edits.  You can also disbale the mod doing the script above

robots.txt is for search engines only
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 25, 2021, 02:08:26 pm
Thanks, I solved the problem. I want to use the Mod, but, first it doesn't rewrite one of the boards. I created 16 boards distributed by 2 categories, and one of the boards continues with the url /index.php?board=18.0 instead of the name.

I install the mod, and immediately all the urls are correct, only this one not.

I run the maintenance, and no change.

But the biggest problem is when I run maintenance it redirects me to the home page, and I don't have more access to the admin panel.

Please help me. I have this mod since about 10 years ibn a 1.1.8 smf forum, and never had any problems.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 25, 2021, 02:11:05 pm
Install the mod again. But use the pretty urls link under manage boards to change the url.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 25, 2021, 02:45:39 pm
Already tried many times. Not possible. When I change there the url there, than it shows the url this way: https://www.mydomain.com/httpswww.mydomain.comgeneral-discussion

I tried only add there the last part, "general-discussion", so it would be correct, but it is not possible.

And about what happens when I run maintenance. What could be the reason?

Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 25, 2021, 03:02:10 pm
The pretty urls root could be wrong.  check in the smf_settings table. for prettyurls root or reset with making a script from
Links point to old domain after moving forum or fix HTTPS
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 25, 2021, 03:59:53 pm
The pretty urls root could be wrong.  check in the smf_settings table. for prettyurls root or reset with making a script from
Links point to old domain after moving forum or fix HTTPS

I installed the way I installed all the others mods. I uploaded the prettyurls.zip file to the Packages folder on my server and extracted it there. Then on my admin panel installed it. No errors. Do you think it was not correct?

Do you mean check smf_settings table in the database?

I don't understand what you say about a script because you didn't finish the sentence.

It may have something to do with the redirect to HTTPS, because I analyzed my site to see if all was good, and even google adsense bot could not see it correctly, and other bots said it had a 500 error, but I don't see anything.

Curiously now I tried to access my site using http, and it is not redirecting to https, but, before it was. And I see that in the footer I still see the copyright of one of your plugins, the contact page or the ad management that I paid to remove the copyright and you helped me by email.

But on the https I don't see it. I send it here attached.

I am beginning to think it is better uninstall everything and begin with a clean installation.

   
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 25, 2021, 04:07:45 pm
You make this script
Code: [Select]
<?php require_once(dirname(__FILE__) . '/SSI.php'); require_once($sourcedir '/Subs-PrettyUrls.php'); updateSettings(array('pretty_root_url' => $boardurl)); pretty_update_filters(); ?>
Place in root of your forum that execute via browser based on the path.

The copyright is an issue with sources/query-string.php i think.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 09:08:32 am
You make this script
Code: [Select]
<?php require_once(dirname(__FILE__) . '/SSI.php'); require_once($sourcedir '/Subs-PrettyUrls.php'); updateSettings(array('pretty_root_url' => $boardurl)); pretty_update_filters(); ?>
Place in root of your forum that execute via browser based on the path.

The copyright is an issue with sources/query-string.php i think.

Could you please be more specific? How do I place this code in the code of the forum? In my case, it is the main domain, so it is in my public_html folder, right?

But I think I need to create a file using notepad, and give a name to the file, and only then place it there. If so, which name I give to the file?

What should I look for in the sources/query-string.php file to solve the problem with the copyright? 
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 09:46:33 am
public_html folder. create with notepad. Give any name you wish.

Attach the sources/Query-string.php file here. But I could be mistaken. I haven't looked at prettyurls in a while so i don't remember how the copyright is generated.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 12:10:15 pm
Ok, I created the file with notepad, and gave the name script.txt

Uploaded to the server in the root directory, and then loaded it on my browser: https://www.mydomain.com/index.php/script.txt

It was supposed to happen something?

I attach here the sources/Query-string.php so you can take a look.

Thanks.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 02:03:21 pm
needs to end in .php not .txt then run it.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 02:18:40 pm
I did it. Deleted the first one. Renamed the original on my PC, uploaded it, and the system added .txt in the end automatically. I renamed it again in the server, removing the .txt.

Then ran it. The page reloaded. How do I verify that what you wanted to do with the script was done?

BTW, at the moment I don't have the mod prettyurls installed, so I can access my admin panel.

Should I have it installed while running this script?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 02:35:42 pm
Yes or you can reinstall pretty urls again and see if it helps.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 02:54:32 pm
I reinstalled it. That specific board had still that board number in the url. Then I ran the script again. No change.

Then I ran the maintenance. No change. I cleaned the files cache and my browser cache, and still no results.

The problem is that I can delete the board, create a new one, but, it will still be the same. All the other 15 boards have the pretty urls.

Any idea?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 03:01:27 pm
Whats the name of the board? I have no other ideas...
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 03:31:40 pm
General Discussion but translated in my language.

Could it be because there is a General Discussion board installed by default when we install SMF?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 03:37:15 pm
Maybe but haven't seen that happen before
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 03:45:21 pm
Ok, I tried a different approach. I created another board under the same category with the name Test, just to see if it would have a number in the URL. No, it was perfect.

Then I changed the name to General Discussion and added the board description. Then I deleted the other one with the number in the url.

All good except that the url of the Test board doesn't change to general-discussion, even after running the maintenance on the pretty urls mod to force the rewrite of the urls.

I really think that has something to do with the default SMF board having this name, and for some reason the software doesn't let the mod rewrite it.

 There is some way to change the name of this url from test to general-discussion manually?
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 03:47:26 pm
There should be  a  Prettyurls link in the boards area next board name to change the url
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 04:22:06 pm
Yes, but like I said yesterday in the reply Nr. 28 in the previous page, it doesn't replace the url but it add to the actual url.

BTW, to be 100% sure it has to do with the default General Discussion board, I just created another board, but this time with the name General Discussion in my language, and immediately the url got the number. Any other name the url doesn't have a number.

Any idea where can I solve this problem? Which mod file should I manually change? Maybe delete some code or insert some? I don't have any experience with code, only very basic things.

Did you take a look in the sources/Query-string.php because of your copyright link?   
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on October 26, 2021, 04:34:42 pm
I am kind of busy this week. Towards the end of next week I might have time to look more depth. Right now i am just going based on memory
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on October 26, 2021, 04:39:52 pm
Ok, I will ask for help on smf. If not solved, I will ask you again in about a week or so.

Thanks.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on November 05, 2021, 08:07:19 am
Hi,

Do you have time now? I still have the problem with pretty urls, your copyright code of the Contact Page Mod is still there somewhere, and can be seen on Firefox using http. On https I don't see it, but on Chrome it can be seen even using https.

The Like button on the LikePosts Mod also do not show up anywhere.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on November 11, 2021, 08:19:20 am
Could you please respond? I paid to delete the copyright and it is still there as you can see in the attachment.

And I still have a big problem with pretty urls too.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on November 11, 2021, 08:20:30 am
I can refund your payment pm me your email. I currently do not have time to look into it.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on November 11, 2021, 08:39:06 am
I don't need a refund. Just need that you say when you can help with the issues.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on November 11, 2021, 08:40:50 am
I don't think i can solve the pretty urls issue.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on November 11, 2021, 09:10:26 am
I don't think i can solve the pretty urls issue.

I don't understand anything about code, but one guy like you saying something like that, I don't believe.

You have lots of Mods, years of experience with code, so you know what the problem is. Yes, it may be something difficult and take much time and you can't do it for free, that I understand, but I am sure someone like you can solve it.

At least let me know what you think it is, so I hire someone to solve the problem.

The other small issues I wait until you have time.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on November 11, 2021, 09:14:50 am
I didn't make pretty urls originally. Yeah I can probably figure it out if I had time. But I am a full time developer and multi business owner this is not a priority for me.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: guest14411 on November 14, 2021, 01:34:37 pm
Well, if it is not a priority for you, then please refund the money because I need to pay someone to find and delete the code of your link that is still somewhere in the website.
Title: Re: prettyurls - TroubleShooting.wiki
Post by: SMFHacks on November 14, 2021, 02:18:59 pm
PM me the email or domain used to order.