From: Matthew M. <ma...@tu...> - 2005-09-20 20:06:52
|
Hello, After talking with a few people privately (since no one responded here *ahem*) I have decided the following. 1) We will go with solution 2 for mod_rewrite. 2) I spoke with Kenneth, who suggested some defaults behavior to reduce link size. For example, in web page, if it just receives an id variable, it will assume that the user just wants to view that web page. This removes a 'user_option=view' addition to the link. 3) Brian came up with an idea for a module I am calling 'Shortcut'. Basically when enabled, you just go to the page, file, article, etc. you want to create the shortcut for and click and add button. Shortcut asks you what you want the shortcut to be named. Then you can just call the item via the shortcut like so: http://phpwebsite.com/index.php?module=shortcut&go=my_favorite_pony OR if you have mod_rewrite enabled, a much shorter version: http://phpwebsite.com/my_favorite_pony I have seen sites use this before so it may not be a 'new' idea but anyway... I should have Shortcuts working this week. Web Pages will be close as well. I figure next week I can release another alpha albeit one that people might actually find useful. Matt out -- Matthew McNaney Electronic Student Services Appalachian State University http://phpwebsite.appstate.edu |
From: Shaun M. <sh...@ae...> - 2005-09-20 21:51:37
|
On 20 Sep 2005, at 20:58, Matthew McNaney wrote: > Hello, > > After talking with a few people privately (since no one responded here > *ahem*) I have decided the following. > > 1) We will go with solution 2 for mod_rewrite. > > 2) I spoke with Kenneth, who suggested some defaults behavior to > reduce > link size. For example, in web page, if it just receives an id > variable, > it will assume that the user just wants to view that web page. This > removes a 'user_option=view' addition to the link. > Good call. I think it would be a good idea if we had more modules default to 'view' behaviour if no action is given. Or to default to a list view of all available items. For instance, http://phpwebsite.appstate.edu/index.php?module=announce and http:// phpwebsite.appstate.edu/index.php?module=faq just give a title and no content. It would be more sensible to go to say the category view or an archive view rather than presenting the user with nothing. Then when we have short urls http://phpwebsite.appstate.edu/announce/ or http://phpwebsite.appstate.edu/faq/ would be useful. > 3) Brian came up with an idea for a module I am calling 'Shortcut'. > Basically when enabled, you just go to the page, file, article, > etc. you > want to create the shortcut for and click and add button. Shortcut > asks > you what you want the shortcut to be named. Then you can just call the > item via the shortcut like so: > > http://phpwebsite.com/index.php?module=shortcut&go=my_favorite_pony > > OR if you have mod_rewrite enabled, a much shorter version: > > http://phpwebsite.com/my_favorite_pony > > I have seen sites use this before so it may not be a 'new' idea but > anyway... > Drupal have a very nice implementation of this which they call an 'alias'. Any content node can be given an alias and referred to throughout Drupal when you create it. It doesn't use mod_rewrite entirely though, it goes through a module to convert links from their shortcuts. They also have a module which automatically gives nodes a short url based on the title of the node. eg. the title of an announcement should you not bother to supply one. Both work best if you can tell modules such as menuman, pagemaster, fatcat etc to use the short url in the urls presented to both admins and users. Otherwise people will still be pasting in long urls into forums and announcements to refer to other parts of the site. Those long urls cause havoc with fixed size CSS based themes where you may only have 4-500 pixels for the forum. Shaun aegis design - http://www.aegisdesign.co.uk aegis hosting - http://www.aegishosting.co.uk |
From: Ken N. <ke...@co...> - 2005-09-20 22:00:31
|
On Tue, 2005-09-20 at 15:58 -0400, Matthew McNaney wrote: > After talking with a few people privately (since no one responded here > *ahem*) I have decided the following. Before responding, I wanted to know what options are open to us and what the ultimate goal is... I have been perusing Apache's mod_rewrite for ideas... Here are my two cents worth (any wisecracks asking if I can afford it will result in a severe kick in the shins). First, I like short URL's and Eloi's implementation of them. They give the illusion of static pages (which helps in search engine rankings) and are relatively easy to remember. Kenneth's idea of "shortcuts" is a good one, but I would rather see short URL's than another core module and another layer of admin. I would like to see phpWebsite be KISS friendly (Keep It Simple Stupid). Second, without a short URL implementation and methodology, I am not sure what purpose mod_rewrite rules ultimately serve... Most (if not all) search engines index long URL's and generally people do not type in URL's, they click a link. For example, how many of us would type in the link to see the latest update on New Orleans (ie. http://www.cnn.com/2005/WEATHER/09/20/rita/index.html) as opposed to going to cnn.com and clicking the link). While I am in favor of making a "go forward" decision as opposed to making no decision, I think we need to do some more research before making that "go forward" decision. I have this nagging feeling we are missing something (perhaps even relatively easy). Based on the scenario of Matt's first email on the subject: > index.php?module=webpage&action=view&id=6&page=2 And my desire to have short URL's like: page6-2.html Perhaps something like this would work: RewriteRule ^page([1-9][0-9]*)-([1-9][0-9]*).html$ index.php?module=pagemaster&action=view&id=$1&%{QUERY_STRING}&page=$2&%{QUERY_STRING} Given that Apache says this on their mod_rewrite page: "This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests, for instance server variables, environment variables, HTTP headers, time stamps and even external database lookups in various formats can be used to achieve a really granular URL matching." I am confident we can find a "simpler" solution. And to restate, I would like to see short URL implementation and methodology before moving on to mod_rewrite. Regards, -- Ken Nordquist "Did I Do That?" |
From: Matthew M. <ma...@tu...> - 2005-09-21 12:42:28
|
> Kenneth's idea of "shortcuts" is a > good one, but I would rather see short URL's than another core module > and another layer of admin. I would like to see phpWebsite be KISS > friendly (Keep It Simple Stupid). I think that having site.com/picnic would be much simpler than site.com/article1_3.html Shortcuts would allow people to actually tell people about a web address. After reading your suggestions, howver, I am thinking that the shortcut should have the .html on the end. The downside to the shortcut is that the url in the address bar can't remain the same because a header location command would control the redirection. > RewriteRule ^page([1-9][0-9]*)-([1-9][0-9]*).html$ ... In the example above, the link specifically is engineered to work with pagemaster. The action is view, the first number is the id, etc. There is nothing wrong with a specific module coming up with their own set of rules. If this is the case, the developer can tell the site admin to copy the line into the .htaccess file. What is needed however is a _generic_ mod_rewrite scheme that developers can use out of the box. The first version of .htaccess has default values. I just ran into problems when I had to add page to the mix. So I had to develop something that would accommodate any type of link you could throw at it. Getting too specific with variables will close off link options. There is another possibility I just thought of. The shortcut module could write to the .htaccess file itself. After registering the key word to a page, article, whatever, you could just push a button and shortcut would write the file. Also when a module is installed for the first time, you could register your specific mod_rewrite line and it would get added. What do you think of that? Matt -- Matthew McNaney Electronic Student Services Appalachian State University http://phpwebsite.appstate.edu |
From: Shaun M. <sh...@ae...> - 2005-09-21 13:51:16
|
So what about the other side of the coin to mod_rewrite? Will say menuman present links in the short format or the full old style format? That is more important and where Eloi's hack to moduleLink() worked, but which I never used for fear of creating obsolete links in my content when fallout finally got a short link system. It'd also mean all links in any module that would benefit from being short, would have to go through the moduleLink() function to get the short URL. As an aside, moduleLink() would be more useful if you could specify a class, add an image (ala phpwsBB) and specify a target. Shaun aegis design - http://www.aegisdesign.co.uk aegis hosting - http://www.aegishosting.co.uk |
From: Shaun M. <sh...@ae...> - 2005-09-20 22:48:12
|
And I'll add that I usually use these mod_rewrite rules... RewriteRule ^announcement([1-9][0-9]*).html$ index.php? module=announce&ANN_user_op=view&ANN_id=$1&%{QUERY_STRING} RewriteRule ^page([1-9][0-9]*).html$ index.php? module=pagemaster&PAGE_user_op=view_page&PAGE_id=$1&%{QUERY_STRING} RewriteRule ^photoalbum.html$ index.php? module=photoalbum&PHPWS_AlbumManager_op=list&%{QUERY_STRING} RewriteRule ^photoalbum([1-9][0-9]*).html$ index.php? module=photoalbum&PHPWS_AlbumManager_op=view&PHPWS_MAN_ITEMS[]=$1&% {QUERY_STRING} RewriteRule ^calendar-event([1-9][0-9]*).html$ index.php? module=calendar&calendar[view]=event&id=$1&%{QUERY_STRING} RewriteRule ^bbforum([1-9][0-9]*).html$ index.php? module=phpwsbb&PHPWSBB_MAN_OP=viewforum&PHPWS_MAN_ITEMS[]=$1&% {QUERY_STRING} RewriteRule ^bbthread([1-9][0-9]*).html$ index.php? module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=$1&%{QUERY_STRING} ...which I think were from Eloi's hack but I've not used the other half of his hack for fear of later upgrade problems and having to hack the hack back in every release. The pagemaster rule is particularly useful as I can easily remember page11.html is my order page or page15.html is my server page. I'm more likely to remember that than remember I've bookmarked it. ;-) Shaun aegis design - http://www.aegisdesign.co.uk aegis hosting - http://www.aegishosting.co.uk |
From: Ken N. <ke...@co...> - 2005-09-21 10:12:19
|
On Tue, 2005-09-20 at 17:59 -0400, Ken Nordquist wrote: > Based on the scenario of Matt's first email on the subject: > > index.php?module=webpage&action=view&id=6&page=2 > > And my desire to have short URL's like: > page6-2.html > > Perhaps something like this would work: > > RewriteRule ^page([1-9][0-9]*)-([1-9][0-9]*).html$ index.php?module=pagemaster&action=view&id=$1&%{QUERY_STRING}&page=$2&%{QUERY_STRING} OK... I just tested this on Eloi's Article mod (because that is the only mod I have available with more than one page) with the following rewrite rule with phpwebsite 10.1 and it works. URL = article3-2.html RewriteRule ^article([1-9][0-9]*)\-([1-9][0-9]*).html$ index.php?module=article&view=$1&%{QUERY_STRING}&page_num=$2& %{QUERY_STRING} Which rewrites to: module=article&view=3&page_num=2 The caveat at this point is that it needs BOTH the article number and the page number. It is a relatively simple implementation of Eloi's short URL hack (which works wonderfully and I wholeheartedly endorse!) Just in case I am being too subtle, I would really like to see an implementation of short URL's for Fallout. -- Ken Nordquist "Did I Do That?" |
From: Ken N. <ke...@co...> - 2005-09-21 12:42:21
|
On Wed, 2005-09-21 at 06:11 -0400, Ken Nordquist wrote: > URL = article3-2.html > > RewriteRule ^article([1-9][0-9]*)\-([1-9][0-9]*).html$ > index.php?module=article&view=$1&%{QUERY_STRING}&page_num=$2& > %{QUERY_STRING} > > Which rewrites to: > > module=article&view=3&page_num=2 > > The caveat at this point is that it needs BOTH the article number and > the page number. It is a relatively simple implementation of Eloi's > short URL hack (which works wonderfully and I wholeheartedly endorse!) After further testing, there is a way to mod_rewrite the URL to default to the first page. ********** RewriteRule ^article([1-9][0-9]*).html$ index.php?module=article&view= $1&%{QUERY_STRING} [L] RewriteRule ^article([1-9][0-9]*)\-([1-9][0-9]*).html$ index.php?module=article&view=$1&%{QUERY_STRING}&page_num=$2&%{QUERY_STRING} [L] ********** The [L] tells mod_rewrite to stop looking for rewrite rules and to apply the current rule. It does work without the [L], but it does eliminate some httpd overhead should mod_rewrite (.htaccess) become a large file. -- Ken Nordquist "Did I Do That?" |