SMFHacks.com

Modifications/Themes => Modifications Talk => Topic started by: [chrisB] on December 30, 2022, 01:05:09 pm

Title: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on December 30, 2022, 01:05:09 pm
Would you be able to tell me how to rewrite URL's like this:

Quote
index.php?page=page3457

Into a friendlier version?
Title: Re: Pretty URL's Pro rewriting URLs
Post by: SMFHacks on December 30, 2022, 09:57:46 pm
It depends on the level of cusotmization changing to /pages/133 is easier than page/title/

https://www.smfhacks.com/index.php/topic,9675.0.html the prettyurls extras is a good start for a coding example has a couple other mods in there.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on December 31, 2022, 10:41:51 am
For safey reasons, I installed the extra mod on my test site and emulated 2.0. It added.
Code: [Select]
# PRETTYURLS MOD ENDS
RewriteRule ^([a-zA-Z0-9-]+)$ index.php?page=page3457=$1
RewriteRule ^([a-zA-Z0-9-]+)/$ index.php?page=page3457=$1

But I see no changes, I have cleared my browser cache, my forums, used the maintain tool within the Pretty URL mod. Any ideas why it might not be doing anything?


I just realised there's a different option for a portal: Tiny Portal which does work.

That makes the url look like: page/page3457/

How would I alter it so that it dropped the first page and gave it a proper title?
Title: Re: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on January 01, 2023, 11:10:35 am
I'll speak with TinyPortal.

I apologise if you have been annoyed or considered my posts to be spam. I'm not exactly sure why my home IP as been banned but I won't post on here after this.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: SMFHacks on January 01, 2023, 12:51:59 pm
No you haven't had time to look at it.
Home IP banned was from someone else. I ban spammers by ip.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on January 28, 2023, 04:50:20 am
I recently tagged you in a post on SMF regarding an issue with my site.

I have posted on another site asking for help, as returning members would tell me they can't access it due to only text showing.

Could editing the 'QueryString.php' file to remove the /index.php cause a conflict with the Pretty URLs Pro mod? This is a reply I got from my support post - https://www.smfhelper.com/index.php?msg=10224

I have tried to replicate this issue in two live environments, but I never made the edit previously mentioned as I didn't think at the time this could be the root of issue. Thing is, I have uninstalled every mod and the same behaviour happens, so it's all weird.


It's caused by an edit I did.

It depends on the level of cusotmization changing to /pages/133 is easier than page/title/

https://www.smfhacks.com/index.php/topic,9675.0.html the prettyurls extras is a good start for a coding example has a couple other mods in there.

/page/title/ is already included.

https://poetryartonline.com/page/articles/

When you next get chance, could you look into removing /page/ from the URLs please.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: SMFHacks on January 31, 2023, 02:03:32 pm
Removing the pages part would be harder require extra database queries as
/a-z/a-z/  is already part of pretty urls for the forum side of category/topic
Title: Re: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on February 01, 2023, 03:56:16 pm
Removing the pages part would be harder require extra database queries as
/a-z/a-z/  is already part of pretty urls for the forum side of category/topic
Rodger, when things free up for you - I'll talk to you about it if that's okay.

Can you remind me what goes in these please?

(https://i.imgur.com/b2QCqQ5.png)
When you tidied up the issues I had before due to the other reactions mod and the installer not working correctly, you added to the skip actions list - I lost it when I installed the last version.

I'll remind myself to make a note :)

My test site redirects to friendly URLs

Whereas my live site '/index.php?action=forum'

That's due to Pretty URLs root not being set right? I've tried sorting this but nothing I have tried corrects it.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: SMFHacks on February 01, 2023, 04:14:31 pm
Skip actions is an action=gallery  that you don't want to rewrite.   So you put "gallery" in that list.
Pretty urls root. No need for anything but is your full web site address https:// etc without a / on the end.
This is mainly used if you change your domain.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on February 01, 2023, 05:03:22 pm
🤦🏻‍♂️ I've broken the logout/login part somehow.

https://poetryartonline.com/index.php?action=forum

I've added my URL to the pretty urls root, used the maintenance tool to update the URLs and cleared my cache (browser and site).

God knows what I've done.

-Edit-

It's the logout part that breaks.

If I sign in via /forum/ it redirects fine.
Title: Re: Pretty URL's Pro rewriting URLs
Post by: SMFHacks on February 01, 2023, 05:09:59 pm
Add logout to the skip actions list
Title: Re: Pretty URL's Pro rewriting URLs
Post by: [chrisB] on February 01, 2023, 05:18:47 pm
It still logs out breaking the pretty urls;

index.php?action=forum instead of /forum/

This is my htaccess file.
Code: [Select]
# PRETTYURLS MOD BEGINS
# Pretty URLs SEO Pro mod
# https://www.smfhacks.com/prettyurls-seo-pro.php
# .htaccess file generated automatically on: February 1, 2023, 22:58

RewriteEngine on
RewriteBase /

# Rules for: tp-articles
RewriteRule ^page/([^/]+)/?$ ./index.php?pretty;page=$1 [L,QSA]

# Rules for: profiles
RewriteRule ^profile/([^/]+)/?$ ./index.php?pretty;action=profile;user=$1 [L,QSA]

# Rules for: actions
RewriteRule ^(agreement|acceptagreement|activate|admin|announce|attachapprove|buddy|calendar)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(clock|coppa|credits|deletemsg|dlattach|editpoll|editpoll2|findmember)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(groups|help|helpadmin|jsmodify|jsoption|likes|lock|lockvoting)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(login|login2|logintfa|logout|markasread|mergetopics|mlist|moderate)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(modifycat|movetopic|movetopic2|notifyannouncements|notifyboard|notifytopic|pm|post)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(post2|printpage|profile|quotefast|quickmod|quickmod2|recent|reminder)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(removepoll|removetopic2|reporttm|requestmembers|restoretopic|search|search2|sendactivation)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(signup|signup2|sitemaps|prettyurls|smstats|suggest|splittopics|stats)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(sticky|theme|trackip|about:unknown|unread|unreadreplies|uploadAttach|verificationcode)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(viewprofile|vote|viewquery|viewsmfile|who|\.xml|xmlhttp|forum)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(tpadmin|forum|tportal|tpshout|awesome|team)/?$ ./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

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php8_module>
   php_flag display_errors Off
   php_flag zlib.output_compression Off
   php_value max_execution_time 90
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 512M
   php_value post_max_size 256M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php73"
   php_value upload_max_filesize 60M
</IfModule>
# END cPanel-generated php ini directives, do not edit

-Edit- It's happening on my fresh installed test site, but only once Tiny Portal was installed.