News:

Want to get involved in developing SMF? 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

Özgür

#2820
oww. Danni is back =)

Quote from: Özgür | ЯocKayseri on November 16, 2008, 12:13:02 PM
my problem is profile page url.
etc :
members name : ruh aleminin gece bekçisi
url
xxx/profile/ruh%20aleminin%20gece%20bek%C3%A7isi/

but i want to
xxx/profile/ruh-aleminin-gece-bekcisi/
im using : utf-8 / smf 2.0b4  / pretty url :0,9


So Long

sgilleland

I entered the rewrite in my htaccess now I get this error


Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


Here is what my .htaccess looks like now
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: December 16, 2008, 19:26

RewriteBase /
RewriteEngine on

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

# Rules for: actions
RewriteRule ^(activate|admin|announce|ban|boardrecount|buddy|buddies|calendar)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(cleanperms|collapse|convertentities|convertutf8|coppa|deletemsg|detailedversion|display)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(dlattach|dumpdb|editpoll|editpoll2|featuresettings|featuresettings2|findmember|form)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(help|gallery|helpadmin|im|invite|jsoption|jsmodify|treasury)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(links|treasury|lock|lockVoting|login|login2|logout|maintain)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(manageattachments|manageboards|managecalendar|managesearch|markasread|membergroups|googlemap|mergetopics)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(mlist|modifycat|modifykarma|modlog|movetopic|movetopic2|news|notify)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(notifyboard|optimizetables|packageget|packages|permissions|pgdownload|pm|post)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(treasuryadmin|treasuryadmin|post2|postsettings|printpage|profile|profile2|quotefast)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(quickmod|quickmod2|recent|regcenter|register|register2|reminder|removetopic2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(removeoldtopics2|removepoll|repairboards|reporttm|reports|requestmembers|search|search2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(sendtopic|serversettings|serversettings2|smileys|smstats|spellcheck|splittopics|stats)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(sticky|theme|trackip|admod|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(viewErrorLog|viewmembers|viewprofile|verificationcode|vote|viewquery|who|\.kml)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(\.xml|tpadmin|forum|tpmod)/?$ ./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]

Dannii

sgilleland: Well no, appears its not that simple! Can you show me what the links look like when it's enabled?

Özgür | ЯocKayseri: Sorry, but as the mod just uses the existing SMF code that's not possible (at least not without a lot of work.)
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

argimiro

#2823
Welcome back Dannii :)

I'm having a slight problem here in that I have a couple of custom rewriterules in my /forums/ directory's old .htaccess, which are getting overwritten by PrettyURLs auto-generated .htaccess

I tried putting those rewriterules up in the parent directory but they don't seem to filter down I guess, because PrettyURLs re-invokes the RewriteEngine?

Is it a worthwhile idea to maybe add a facility in the admin panel, maybe a small textarea or something, to add a couple of additional / custom rewriterules if desired..

In my case it was


RewriteCond %{HTTP_USER_AGENT} slurp [NC]
RewriteRule ^.* - [F]


I wanted to 'splice in' (trying to prevent yahoo spider hammering the board) - I found where to edit pretty_update_filters() in Subs-PrettyURLs.php to 'handball' it in, so that it gets re-included whenever the filters are updated.. but thought an option interface might be good. Or would it be a bad idea.

Dannii

Yeah that's an idea I had before actually...

For now you can add them to Subs-PrettyUrls.php. Search for "#   Pretty URLs mod"
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Phat^Trance

any good robots.txt for users that use the Pretty URL mod?
i want to filter out all the junk like profiles, registration site etc
Daily Mobile Blog:  http://dailymobile.se/
Daily iPhone Blog: http://dailyiphoneblog.com/
Daily Mobile forum: http://forum.dailymobile.se/

mkress

hi Dannii!

very great mod!

i have one suggestions for the next release.
it would be great to have a function that i can call to "manually" create a pretty url.
My Problem is, that I have want a 301 redirect to a prett url in some circumstances - but pretty_urls only rewrites links that get printed to the html - so it would be great to have a function to manually create a pretty url.

hope you know what I am talking about...

markus :)

mark7144

Quote from: Dannii on January 09, 2009, 08:39:00 PM
If you want help please post again, I won't go through the old posts.
Danni, sorry to bring this up again but I'm shocked at the size of my cache table and I want to be certain it is normal. Can you explain why it is not much smaller than my messages table? That doesn't make any sense to me.

smf_messages    195.83 MB
smf_pretty_urls_cache 101.23 MB

If the above really is normal, then I strongly recommend you consider a way to prevent the cache getting so big. Maybe have it so it only caches URLs from the last X number of days.

Dannii

Quote from: fca07 on January 10, 2009, 08:05:49 AM
hi Dannii!

very great mod!

i have one suggestions for the next release.
it would be great to have a function that i can call to "manually" create a pretty url.
My Problem is, that I have want a 301 redirect to a prett url in some circumstances - but pretty_urls only rewrites links that get printed to the html - so it would be great to have a function to manually create a pretty url.

hope you know what I am talking about...

markus :)
301 redirects already get prettified. How are you doing the redirect?

Quote from: mark7144 on January 10, 2009, 09:31:25 AM
Danni, sorry to bring this up again but I'm shocked at the size of my cache table and I want to be certain it is normal. Can you explain why it is not much smaller than my messages table? That doesn't make any sense to me.

smf_messages    195.83 MB
smf_pretty_urls_cache 101.23 MB

If the above really is normal, then I strongly recommend you consider a way to prevent the cache getting so big. Maybe have it so it only caches URLs from the last X number of days.
That seems perfectly normal, remember that each topic will have many many URLs. It does get big, but it's efficient. Are you actually running out of space? If not, don't worry! If you are, could you set up a cron job on your server perhaps?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

asmith

Hi,
I'm new to this, I've installed it and I'm using it and it is working fine.
I don't know it has been mentioned before, But for this mod quality sake, I wanna ask for some changes in it.

in VB, when you open up a topic,  the topic ID is written at the first of the url, for example : 

example.com/23453-topic-name/

now if I edit the topic name, and need to change its name, the number is still there. I've tried to change the topic name in the url in a vb forum, unless I don't touch that number, it redirects me to the correct name.

for example this topic in vb forum  :
http://www.computerforum.com/140935-google-redirects-cant-open-malwarebytes-etc.html

do not change the .html at the end.  if you leave the name, and only change the number topic changes.

I'm not sure, but I guess in your mod, if i change the topic name, topic url still will remain the previous one.
If my topic is "good dog" ,  but I change the subject to "bad dog",   my url is still "example.com/good-dog/" while topic is something else.

As google cache these pages, I guess it is so important an old cached page in google redirects to its new version.

mkress

Quote from: Dannii on January 10, 2009, 10:11:07 PM
301 redirects already get prettified. How are you doing the redirect?

i do for example rewrite old profile-urls to the pretified:

   if($context['current_action'] == 'profile'){
       
//only redirect "wrong" urls
       
$url =  '/forum/profile/'.urlencode($context['member']['username']).'/';
       if(
$context['current_subaction'] != NULL && $context['current_subaction'] != 'summary')
       
$url .= '?sa='.$context['current_subaction'];
       if(isset(
$_GET['start'])) $url .= ';start='.intval($_GET['start']);
       if(
$_SERVER['REQUEST_URI'] != $url && !strstr($_SERVER['REQUEST_URI'], 'changeusername')){
           
header('HTTP/1.1 301 Moved Permanently');
           
header ('Location: '.$url);
       }
   }


but i have to say i am using pretty urls 0.8.4 - i don't think that in the new version old profile-urls are rewritten to the pretified (or am I wrong?)..
How can I update 0.8.4 to 0.9 - have I to uninstall 0.8.4 and reinstall 0.9?

Dannii

Quote from: asmith on January 11, 2009, 12:28:32 AM
Hi,
I'm new to this, I've installed it and I'm using it and it is working fine.
I don't know it has been mentioned before, But for this mod quality sake, I wanna ask for some changes in it.

in VB, when you open up a topic,  the topic ID is written at the first of the url, for example : 

example.com/23453-topic-name/

now if I edit the topic name, and need to change its name, the number is still there. I've tried to change the topic name in the url in a vb forum, unless I don't touch that number, it redirects me to the correct name.

for example this topic in vb forum  :
http://www.computerforum.com/140935-google-redirects-cant-open-malwarebytes-etc.html

do not change the .html at the end.  if you leave the name, and only change the number topic changes.

I'm not sure, but I guess in your mod, if i change the topic name, topic url still will remain the previous one.
If my topic is "good dog" ,  but I change the subject to "bad dog",   my url is still "example.com/good-dog/" while topic is something else.

As google cache these pages, I guess it is so important an old cached page in google redirects to its new version.
That's how vbSEO does it... and I think my mod does it better! It does increase load on the MySQL server slightly, but I think not having the numbers at all is worth it. As to the topic titles changing... well Cool URLs don't change. That said, in the (possibly distant) future I do plan on adding a feature for changing the URL. You can already change board URLs.

Quote from: fca07 on January 11, 2009, 04:16:05 AM
i do for example rewrite old profile-urls to the pretified:
You should use the redirectExit() function.

Quotebut i have to say i am using pretty urls 0.8.4 - i don't think that in the new version old profile-urls are rewritten to the pretified (or am I wrong?)..
How can I update 0.8.4 to 0.9 - have I to uninstall 0.8.4 and reinstall 0.9?
Yes that's correct.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

asmith

#2832
Yes you are right. Nice one :)

ok, I've found 2 conflicts with nneonneo's shoutbox mod on my web site. 
When I'm on the some topics on the forum which has more than one page, for example like this one :

http://www.example.com/forums/discussion/topic-name/15/

meaning page 2 of that topic (I have set it like every 15 msg one page).

my shoutbox gives this error :

Invalid request variable.


I've searched the entire forum files for this error, and there are only 2 lines in the whole forum,they are in the querystring.php:


// These keys shouldn't be set...ever.
if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
die('Invalid request variable.');

// Same goes for numeric keys.
foreach (array_merge(array_keys($_POST), array_keys($_GET), array_keys($_FILES)) as $key)
if (is_numeric($key))
die('Invalid request variable.');


any idea?

Second conflict with this shoutbox is, I can't delete any shout, as it gives the error  "session verification failed"

I've tried turning pretty urls off for both conflicts, and both worked fine again. So I'm sure this conflict is because this mod.

p.s the deleting shout is not bothering me, but the first conflict will mess up the entire shoutbox.

EDIt :
Oh another thing to mention :D
Sorry about bothering you, its just I've been in SEO a lot before and I'm so happy you have set it up for SMF.

In the past I had tried rawurlencode() for converting arabic characters into a url and I see google cares about them enough. meaning my page url in the google result (which was converted with that function) , had became to original characters (google converts them back).
As I checked this mod, it converts arabic characters into some kinds of numbers? 
Is it because I have done something wrong in the settings ? Or it really convert them to numbers?

If so, is there an easy edit so I could rawurlencode them instead of number format?

Jordy3738

#2833
Newbie needs help...I installed the Pretty URLs and now I get an error message when  go to my sites address.

http://www.guitaradvertisingforum.com

Please give me step by step details explaining where I will find
the things that you suggest for me to do.

Thanks, Jordy

sgilleland

Quote from: Dannii on January 09, 2009, 11:02:48 PM
sgilleland: Well no, appears its not that simple! Can you show me what the links look like when it's enabled?

Danni,
When it is enabled it appears the it works as far as changing the URL's... but I get the error 404.

Phat^Trance

i have a question!
if i upgrade my forum or the forum gets hacked / crached will all my URL get lost?
Im using those mod right now and im linking alot from my blog to the forum. Im just afraid that if the forum crash all my links will be broken from the blog and so on.

Thx
Daily Mobile Blog:  http://dailymobile.se/
Daily iPhone Blog: http://dailyiphoneblog.com/
Daily Mobile forum: http://forum.dailymobile.se/

Dannii

Quote from: asmith on January 11, 2009, 08:26:31 AM
Yes you are right. Nice one :)

ok, I've found 2 conflicts with nneonneo's shoutbox mod on my web site. 
When I'm on the some topics on the forum which has more than one page, for example like this one :

http://www.example.com/forums/discussion/topic-name/15/

meaning page 2 of that topic (I have set it like every 15 msg one page).

my shoutbox gives this error :

Invalid request variable.


I've searched the entire forum files for this error, and there are only 2 lines in the whole forum,they are in the querystring.php:


// These keys shouldn't be set...ever.
if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
die('Invalid request variable.');

// Same goes for numeric keys.
foreach (array_merge(array_keys($_POST), array_keys($_GET), array_keys($_FILES)) as $key)
if (is_numeric($key))
die('Invalid request variable.');


any idea?

Second conflict with this shoutbox is, I can't delete any shout, as it gives the error  "session verification failed"

I've tried turning pretty urls off for both conflicts, and both worked fine again. So I'm sure this conflict is because this mod.

p.s the deleting shout is not bothering me, but the first conflict will mess up the entire shoutbox.

EDIt :
Oh another thing to mention :D
Sorry about bothering you, its just I've been in SEO a lot before and I'm so happy you have set it up for SMF.

In the past I had tried rawurlencode() for converting arabic characters into a url and I see google cares about them enough. meaning my page url in the google result (which was converted with that function) , had became to original characters (google converts them back).
As I checked this mod, it converts arabic characters into some kinds of numbers? 
Is it because I have done something wrong in the settings ? Or it really convert them to numbers?

If so, is there an easy edit so I could rawurlencode them instead of number format?
Can you check that all of the shoutbox's URLs are full URLs which include $scripturl?

Quote from: Jordy3738 on January 11, 2009, 02:02:15 PM
Newbie needs help...I installed the Pretty URLs and now I get an error message when  go to my sites address.

http://www.guitaradvertisingforum.com

Please give me step by step details explaining where I will find
the things that you suggest for me to do.

Thanks, Jordy
It looks like the mod has been installed twice. Do you have other mods on your forum?

Quote from: sgilleland on January 11, 2009, 04:29:52 PMWhen it is enabled it appears the it works as far as changing the URL's... but I get the error 404.
Please show me the actual URLs!

Quote from: Phat^Trance on January 11, 2009, 05:15:27 PM
i have a question!
if i upgrade my forum or the forum gets hacked / crached will all my URL get lost?
Im using those mod right now and im linking alot from my blog to the forum. Im just afraid that if the forum crash all my links will be broken from the blog and so on.

Thx
If you do a package manager update then the mod will stay installed and everything should be fine. If you Do a large upgrade you'll need to reinstall the mod.

And if your forum crashes, well your links will be broken anyways!
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

sgilleland

Here is the url with it turned off  http://www.dreamconnectionz.com/index.php?action=forum

Here is the same one with Pretty URL's turned on. http://www.dreamconnectionz.com/forum/


Is that what you needed?


Dannii

Do you have a .htaccess file in your / folder?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

sgilleland

yes, the forum resides in /bdg and this is the .htaccess that is in it.

# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: December 16, 2008, 19:26


RewriteEngine on

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

# Rules for: actions
RewriteRule ^(activate|admin|announce|ban|boardrecount|buddy|buddies|calendar)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(cleanperms|collapse|convertentities|convertutf8|coppa|deletemsg|detailedversion|display)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(dlattach|dumpdb|editpoll|editpoll2|featuresettings|featuresettings2|findmember|form)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(help|gallery|helpadmin|im|invite|jsoption|jsmodify|treasury)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(links|treasury|lock|lockVoting|login|login2|logout|maintain)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(manageattachments|manageboards|managecalendar|managesearch|markasread|membergroups|googlemap|mergetopics)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(mlist|modifycat|modifykarma|modlog|movetopic|movetopic2|news|notify)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(notifyboard|optimizetables|packageget|packages|permissions|pgdownload|pm|post)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(treasuryadmin|treasuryadmin|post2|postsettings|printpage|profile|profile2|quotefast)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(quickmod|quickmod2|recent|regcenter|register|register2|reminder|removetopic2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(removeoldtopics2|removepoll|repairboards|reporttm|reports|requestmembers|search|search2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(sendtopic|serversettings|serversettings2|smileys|smstats|spellcheck|splittopics|stats)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(sticky|theme|trackip|admod|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(viewErrorLog|viewmembers|viewprofile|verificationcode|vote|viewquery|who|\.kml)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(\.xml|tpadmin|forum|tpmod)/?$ ./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]


When I enter the RewriteBase /  in it....it gives me the following  error.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Advertisement: