Facebook 

SMFHacks.com - Celebrating 20 Years!

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4342
Latest: eva
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 44312
Total Topics: 7676
Most Online Today: 607
Most Online Ever: 27044
(May 30, 2026, 09:10:16 pm)
Users Online
Members: 0
Guests: 318
Total: 318

Author Topic: prettyurls - TroubleShooting.wiki  (Read 36757 times)

0 Members and 1 Guest are viewing this topic.

prettyurls - TroubleShooting.wiki
« on: »
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]
« Last Edit: August 31, 2019, 06:46:15 am by SMFHacks »
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #1 on: »
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.

Re: prettyurls - TroubleShooting.wiki
« Reply #2 on: »
Make sure .htaccess file has the pretty urls listed inside it as well.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #3 on: »
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!

Re: prettyurls - TroubleShooting.wiki
« Reply #4 on: »
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
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #5 on: »
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!

Re: prettyurls - TroubleShooting.wiki
« Reply #6 on: »
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!

Re: prettyurls - TroubleShooting.wiki
« Reply #7 on: »
That's odd...Drop the pretty_urls_cache table from the database.
The max size would be 255...not sure how they get 1000
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #8 on: »
Drop the pretty_urls_cache table from the database.

I tried that already, and it didn't work I am afraid.

Re: prettyurls - TroubleShooting.wiki
« Reply #9 on: »
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');
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #10 on: »
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #11 on: »
....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.

Re: prettyurls - TroubleShooting.wiki
« Reply #12 on: »
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?

Re: prettyurls - TroubleShooting.wiki
« Reply #13 on: »
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
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: prettyurls - TroubleShooting.wiki
« Reply #14 on: »
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?

 

Related Topics

  Subject / Started by Replies Last post
7 Replies
10404 Views
Last post October 07, 2006, 11:43:40 pm
by Nite
14 Replies
16119 Views
Last post December 08, 2011, 01:39:57 am
by Vincent Volmer
0 Replies
4799 Views
Last post May 31, 2017, 10:49:05 pm
by SMFHacks
0 Replies
6103 Views
Last post July 13, 2018, 04:22:02 pm
by SMFHacks
0 Replies
6569 Views
Last post July 13, 2018, 04:23:01 pm
by SMFHacks

+- Recent Topics

Registration - anti bot pattern matching by SMFHacks
November 01, 2026, 07:20:17 pm

EZPortal 8 by davejo
October 21, 2026, 01:01:54 pm

Downloads Pro 7.0 Released by SMFHacks
October 07, 2026, 07:35:30 pm

[Mod]ActivityPub Federation for SMF 2.1 by SMFHacks
October 01, 2026, 05:03:45 pm

Newsletter Pro 4.0 Released by SMFHacks
September 23, 2026, 08:08:24 pm

Can't remove or restore any item from the recycle bin by SMFHacks
September 22, 2026, 11:01:51 am

MCP Server for SMF 2.1 - let Claude, ChatGPT or Cursor run your admin chores by SMFHacks
September 12, 2026, 02:50:45 pm

Suggestions for improvements to Ultimate Shoutbox & Chatroom by davejo
September 02, 2026, 01:35:09 am

Automatic Sorting of Categories by Kiwi
August 31, 2026, 12:36:09 am

' appears as &#39; in Most Viewed (and Recent Items ?) by SMFHacks
August 22, 2026, 11:01:56 pm

Powered by EzPortal