News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Pretty URLs

Started by SMFHacks.com Team, January 31, 2007, 10:56:43 AM

Previous topic - Next topic

MESWEB

Quote from: vbgamer45 on December 27, 2015, 12:52:30 PM
[code
# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: December 22, 2015, 18:00

RewriteEngine on
RewriteBase /

# Rules for: actions
RewriteRule ^(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(coppa|contact|credits|deletemsg|display|dlattach|editpoll|editpoll2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(emailuser|findmember|groups|help|gallery|helpadmin|im|jseditor)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(jsmodify|jsoption|lock|lockvoting|login|login2|logout|markasread)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(mergetopics|mlist|moderate|modifycat|modifykarma|movetopic|movetopic2|notify)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(notifyboard|openidreturn|pm|post|post2|printpage|profile|quotefast)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(quickmod|quickmod2|recent|register|register2|related|reminder|removepoll)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(removetopic2|reporttm|requestmembers|restoretopic|search|search2|sendtopic|sitemap)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(smstats|suggest|spellcheck|splittopics|SMFQuiz|SMFQuizAnswers|SMFQuizStart|SMFQuizEnd)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(SMFQuizQuestions|SMFQuizDispute|SMFQuizAjax|SMFQuizExport|stats|sticky|theme|topicsolved)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(trackip|about:mozilla|about:unknown|unread|unreadreplies|verificationcode|viewprofile|vote)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(viewquery|viewsmfile|who|\.xml|xmlhttp)/?$ ./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

OMG! I'm asking about rewrite rules for HTTPS not for default. BTW do You know something about programming?

vbgamer45

No sorry those rules work for https....
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

cieplutki

not working I still got community




.

MESWEB

Quote from: vbgamer45 on December 27, 2015, 01:44:45 PM
No sorry those rules work for https....
This is working for https? Are You kidding me? This rules don't redirect me to https urls.

vbgamer45

yes it works that. .htaccess doesn't need to change you just need to change the base url in pretty urls to https:/// check a couple posts back someone explains it.
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

MESWEB

Yes i know and I'm update this value in db. But when I type my url like http://domain.com then I don't be redirect to https://domain.com
This is code for https. Do You have any basic knowledge about programming?
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://domain.com/%{REQUEST_URI} [R,L]

vbgamer45

Yes i know how to do all of that.....But you weren't asking that...and if you know how to do it then why are you asking me....
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

MESWEB

Because this rewrite rules working fine only for few days, after that I can't write new posts or modify existing. I think this is a bug from cache or something like this.

MESWEB

Quote from: cieplutki on December 27, 2015, 02:19:43 PM
not working I still got community
Try this :
Replace:
RewriteRule ^(coppa|contact|credits|deletemsg|display|dlattach|editpoll|editpoll2)/?$ ./index.php?pretty;action=$1 [L,QSA]
With:
RewriteRule ^(coppa|community|contact|credits|deletemsg|display|dlattach|editpoll|editpoll2)/?$ ./index.php?pretty;action=$1 [L,QSA]
This should work.

AllMassive

#7369
Quote from: MESWEB on December 27, 2015, 12:41:22 PM
looks like working but I see issue:
home url is http not https

Sound like you didnt change the main-url insinde your SMF.
Are you sure that you changed the main forum url in Configuration/Server/Database to the https:// url ?

Quote from: MESWEB on December 27, 2015, 02:49:16 PM
Yes i know and I'm update this value in db. But when I type my url like http://domain.com then I don't be redirect to https://domain.com
You need access to the apache-config for your domain port 80 virtual domain - you need:

Redirect permanent / https://your-forum.url/


MESWEB

Yes I have changed url to https in configuration/database/server already.

Sorry I don't have access to server configuration files. I can use only .htaccess

cieplutki

I do not use https: only http:




.

MESWEB

@Cieplutki we speak about https not about Your problem. To solve Your problem try use my solution from this post:
http://www.simplemachines.org/community/index.php?topic=146969.msg3853420#msg3853420

cieplutki

not working, entries will be eight.
maybe something like that:
RewriteCond %{REQUEST_URI} ^/index.php?action=community$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ http://ewmapa.pl/community [L,R=301]





.

AllMassive

Quote from: MESWEB on December 28, 2015, 04:46:14 AM
Sorry I don't have access to server configuration files. I can use only .htaccess
.htaccess is only for url-rewriting 'on-the-fly'.
For the real forward to https you need that entry in the apache-vhost.cfg

Jade Elizabeth

Quote from: Cheat on December 05, 2015, 03:41:43 PM
Does anyone know how to get the links on the forum to output user URLs as IDs? (/profile/1/ instead of /profile/user/)? I understand .htaccess rewrites, but I can't find where the mod changed all the urls to that structure on the forum.

EDIT: I figured it out myself. For those who are wanting the same thing, here you go (it's really easy):

in .htaccess

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


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


in /Sources/PrettyUrls-Filters.php

Find
$memberNames[$row['id_member']] = rawurlencode($row['member_name']);

Replace
$memberNames[$row['id_member']] = rawurlencode($row['id_member']);

Done. :)

Can this be officially added as an option by any chance?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Jingaling

Having some issues with getting a WordPress site that's in a sub-directory working. I assume it's something to do with PrettyURL's. I posted something in the general support forums, and they sent me here. More info is here: http://www.simplemachines.org/community/index.php?topic=542474.0

I've tried adding /blog to the "Skip Action List" but it doesn't seem to be working.

Thanks.

vbgamer45

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

Jingaling

Quote from: vbgamer45 on January 05, 2016, 09:22:16 AM
http://code.google.com/p/prettyurls/wiki/TroubleShooting

Thanks, that worked. Just in case anyone didn't know, here's the line I added to my htaccess file. My WordPress blog is at /blog.

#Rule to allow access to blog.
RewriteRule ^blog/?$ /blog/index.php [L,QSA]

Fisch.666

#7379
Hi,

i had uninstalled this mod and used the reverter packge afterwards. This created:


RewriteBase /forum
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]


amongst other rules within the .htaccess. Today i've noticed that all requests, even not valid ones like:

http://example.com/forum/abc

are redirected to:

http://example.com/forum/index.php

The main difference is, that a valid call like:

http://example.com/forum/news

is redirecting correctly to:


HTTP/1.1 301 Moved Permanently
Location: http://example.com/forum/index.php?board=2.0
...


where an invalid call like:

http://example.com/forum/abc

only gets an:


HTTP/1.1 200 OK
...


Does anyone has any insight how this rewrite can be improved so only valid requests get the redirect? Thanks in advance for a reply.

Advertisement: