Pretty URLs

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

Previous topic - Next topic

coendeurloo

Quote from: Dannii on January 20, 2009, 05:28:53 AM
If you post joomla's .htaccess I'll see what can be done...

Sure, here it is:

##
# @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section



Dannii

Try adding the mod's .htaccess file before all of that. You will need to add forum/ at the beginning of each like this:
Code (find) Select
RewriteRule ^(activate|admin|announce|ban|boardrecount|buddy|calendar|cleanperms)/?$ ./index.php?pretty;action=$1 [L,QSA]
Code (replace) Select
RewriteRule ^forum/(activate|admin|announce|ban|boardrecount|buddy|calendar|cleanperms)/?$ ./index.php?pretty;action=$1 [L,QSA]
"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."

Moif

Quote from: Dannii on January 15, 2009, 08:36:50 AM
Quote from: pcigre on January 15, 2009, 04:44:00 AM
I'm having some performance issues with PRetty url...

"Page created in 1.847 seconds with 18 queries. (Pretty URLs adds 1.779s, 2q)"

and on many pages even more... our forum haqs about 300k posts. Its on VPS.

smf_pretty_urls_cache 1,085,225 records in it and 147MB ...

Oh dear!
Can you turn on the query debugging, and copy that info here please?

Quote from: Moif on January 15, 2009, 05:52:04 AM
Hello!

I installed this mod and nothing happened! I checked my error logs and I'm seeing:

Quote
8: Undefined index: pretty_admin_menu
File: [PATH OMITTED]/forums/Sources/Subs.php
Line: 2895

So I've had a look at line 2895 and can see ?action=admin;area=pretty which I tagged onto the end of my forum index url manually in the browser and there was the admin panel :) So I have it installed and working but I'm getting that error and have no pretty_admin_menu

Any advice?
Looks like the language files didn't get modified correctly. Make sure all the entries got added to modifications.english.php.

Ok, thanks. Great mod btw.



L'AltroWeb

How i can set pretty urls info in the footer?

coendeurloo

Quote from: Dannii on January 20, 2009, 06:07:02 AM
Try adding the mod's .htaccess file before all of that. You will need to add forum/ at the beginning of each like this:
Code (find) Select
RewriteRule ^(activate|admin|announce|ban|boardrecount|buddy|calendar|cleanperms)/?$ ./index.php?pretty;action=$1 [L,QSA]
Code (replace) Select
RewriteRule ^forum/(activate|admin|announce|ban|boardrecount|buddy|calendar|cleanperms)/?$ ./index.php?pretty;action=$1 [L,QSA]

Thanks Dannii, it doesn't seem to work yet though. It recreated the .htaccess in the forums root too when I enabled pretty urls again, but I've deleted it, yet it doesn't work. this is my current .htaccess file situated in the joomla root:

# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: January 20, 2009, 9:10

RewriteEngine on
RewriteBase /

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

# Rules for: boards
RewriteRule ^forum/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^forum/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^forum/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^forum/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

##
# @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section



Dannii

Dark-Wolf, what info?

coendeurloo, arghh silly me sorry. Before index.php add another forum/
"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."

L'AltroWeb

#2906
Quote from: Dannii on January 20, 2009, 06:00:47 PM
Dark-Wolf, what info?
n°queries etc :)
Edit:
Like this: Page created in 0.22 seconds with 13 queries. (Pretty URLs adds 0.024s, 1q)

CueBurn

Quote from: Dannii on January 20, 2009, 04:56:20 AM
CueBurn: '!'   =>   array ('!'),

Thank you!  I've removed the line and managed to create a "tar.gz" file to then reinstall.  It's still not recognising links with a "!" at the end though (of which there are a lot on my forum!)...  I think there were some tables or something that needed to be removed too?  If it's not too much trouble would you mind letting me know what the next step is please?  I'm not a whizz at coding but I try!  Cheers  :D

coendeurloo

Quote from: Dannii on January 20, 2009, 06:00:47 PM
Dark-Wolf, what info?

coendeurloo, arghh silly me sorry. Before index.php add another forum/

You are my hero and you rule! Thanks a million, it works like a charm!

lobo777

Hey, I have enjoyed using this mod - definitely cleans things up a lot for the members.  Until recently I had been running it - I am now having a pretty big issue.

So I have been trying to do some canonical changes in my urls from non-www to www only so I disabled and uninstalled the mod.  I later turned it back on after changing everything back in my .htaccess file and it works fine for the most part... HOWEVER,  now when a member is logged in at the Index level, everythings great - when they go to a board or topic, it immediately shows that a member is no longer logged in.  If I hit the home/forum button it goes back to the index and shows as being logged in again!

I have disabled it for now and everything is ok with the members staying logged in, so I'm assuming it is something with what I did with pretty url earlier.  Any ideas?

lobo777

You know, I just noticed that it states that it uses the user name not the display name... is this perhaps the problem, since the account that I am using has a different username than the display name?

JoshieDaMan

#2911
Quote from: Dannii on January 20, 2009, 04:56:20 AM
Quote from: JoshieDaMan on January 19, 2009, 05:11:12 AM
I need a redirecting code for this. There's one feature that aren't working that I have integrated. How to get it to redirect to /index.php?action=chat because it redirected me to /chat and it's not working properly. Only shown the template but not the chat.
It is probably using relative URLs. Make sure everything uses full URLs with http://yourdomain.com etc. If that doesn't work I'll look into it more.

The url is with www and as well without www. But most used is www.

EDIT: Won't let me even go to /blog where the wordpress is, and others.

L'AltroWeb

#2912
From my precedent post.
Footer Info like this:
Page created in 0.22 seconds with 13 queries. (Pretty URLs adds 0.024s, 1q)
-
New question:
I've update Subs-PrettyUrls.php with this: // Build the new .htaccess file
$htaccess = '# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: ' . date('F j, Y, G:i') . '
# MOD by DarkWolf

# Favicon
AddType image/x-icon .ico

RewriteEngine on
RewriteBase /forum

# Rules for: guestbook
RewriteRule ^guestbook/$ /forum/index.php?action=guestbook [L,QSA]

# Rules for: rules
RewriteRule ^regolamento/$ /forum/index.php?action=rules [L,QSA]

# Rules for: sitemap
RewriteRule ^sitemap-php/$ /forum/index.php?action=sitemap [L,QSA]
RewriteRule ^smf_sitemap.xml$ /forum/index.php?action=sitemap;xml [L,QSA]

# Rules for: rss
RewriteRule ^rss/$ /forum/.xml/?type=rss [L,QSA]';

for some personal rules to the top of htaccess.
How i can edit to put other rules to the bottom?
For Add an Apache Error Handler to SMF  ???

mark7144

Dannii: For a future version, are you planning on making it easier for admins to change the URL of a topic?

I often rename topics and would love to be able to change the URL along with that but at the moment it involves going into the database.

krick

#2914
I'm trying to install Pretty URLs 0.9 on SMF 1.1.7 and I get this error in the package manager.  I've tried all the standard fixes like manually creating the temp directory and setting the permissions to 777.  Any ideas on how to get it installed?...

Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    SMF1-1/Sources.xml    Modification parse error
2.    Execute Modification    -    Modification parse error
3.    Execute Modification    SMF1-1/BoardsAndTopics.xml    Modification parse error
4.    Execute Modification    -    Modification parse error
5.    Execute Modification    SMF1-1/Themes.xml    Modification parse error
6.    Execute Modification    -    Modification parse error
7.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test successful
8.    Execute Modification    ./Themes/default/languages/Modifications.english-utf8.php    Skipping file
9.    Execute Modification    ./Themes/default/languages/Modifications.french.php    Skipping file
10.    Extract File    ./Sources/PrettyUrls.php    
11.    Extract File    ./Sources/PrettyUrls-Filters.php    
12.    Extract File    ./Sources/Subs-PrettyUrls.php    
13.    Extract File    ./Themes/default/PrettyUrls.template.php    
14.    Extract Tree    ./Themes/default/pretty    
15.    Extract File    ./Themes/default/languages/PrettyUrls.english.php    
16.    Extract File    ./Themes/default/languages/PrettyUrls.french.php    
17.    Execute Code    SMF1-1/install.php



UPDATE:  Examining the issue further, it appears that $sourcedir in the installation files is not resolving to the correct directory.  Here's a sample message from the error log...

2: file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/PrettyUrls.english.php) is not within the allowed path(s): (/var/www/vhosts/tankadin.com/httpdocs:/tmp)
File: /var/www/vhosts/tankadin.com/httpdocs/forum/Sources/Subs-Package.php
Line: 327

Jordy3738

Just curious,  is it possible to get phone suppot from sone one to walk me through the process of how to get my forum operating again?

I installed the Pretty URLs modification and my forum just shows an error message now.
http://guitaradvertisingforum.com

Thanks, Jordy

_Anthony_

Quote from: Jordy3738 on January 23, 2009, 03:59:13 PM
Just curious,  is it possible to get phone suppot from sone one to walk me through the process of how to get my forum operating again?

I installed the Pretty URLs modification and my forum just shows an error message now.
http://guitaradvertisingforum.com

Thanks, Jordy
Post Sources/QueryString.php
I'll try to figure it out.

L'AltroWeb

#2917
Quote from: mark7144 on January 22, 2009, 08:54:39 AM
Dannii: For a future version, are you planning on making it easier for admins to change the URL of a topic?

I often rename topics and would love to be able to change the URL along with that but at the moment it involves going into the database.
Maybe you can make this mod:
http://www.simplemachines.org/community/index.php?topic=146969.msg1574878#msg1574878 ;)
I have make it fot my forum and it work fine :)
-
@Danni: i've fixed my precedent footer questions with this:
-
// Update the load times
//$pattern = '~<span class="smalltext">' . $txt['smf301'] . '([.0-9]+)' . $txt['smf302'] . '([0-9]+)' . $txt['smf302b'] . '</span>~';
$pattern = '~' . $txt['smf301'] . '([.0-9]+)' . $txt['smf302'] . '([0-9]+)' . $txt['smf302b'] . '~';

-
Theme problem, now is ok ;)

bigboss2

#2918
I am having problem with my rss feeds. My site url is http://www.cricket-highlights.com/index.php [nofollow] Can anyone tell me why links in feeds are not working correctly.

locau

hello there,

after the upgrade i have an error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in www/forum/Sources/QueryString.php on line 217

i've uninstalled the old version and installed after the new version (0.9), the install process gaive me an error on "querystring.php" so i think all changes on that file weren't made so i did them manualy according to the parse code.

The new code changes a bit here so i don't know if it will make any difference :

old -> $_REQUEST['board'] = str_replace(array('&#039;', '\\'), array("\x12", ''), $_REQUEST['board']);
new -> $_REQUEST['board'] = str_replace(array(''', '\\'), array("\x12", ''), $_REQUEST['board']);

How can i fix this pls ?


Advertisement: