| htaccess rewrite - applied to final directory name of URL
|
el_roboto

msg:3460639 | 7:12 pm on Sep 25, 2007 (gmt 0) | I haven't done much with htaccess for a few months, I'm hoping to achieve the goals below, I know number 1 is possible as I have applied it previously, but how about number 2? I'm off do a refresh on htaccess anyway but any suggestions on the second goal would be appreciated, even links! 1) unless a file type is specified, add a trailing backslash to URL ie: from www.this.com/hello/webmaster/control_panel to www.this.com/hello/webmaster/control_panel/ 2) rewrite URL based on the final directory of the specified URL ie: from www.this.com/hello/webmaster/control_panel/ to www.this.com/index.php?id=control_panel OR from www.this.com/something/fruit/green/apples/ to www.this.com/index.php?id=apples This rule needs to assess what is between the final two forward slashes
|
jdMorgan

msg:3460871 | 11:29 pm on Sep 25, 2007 (gmt 0) | 1) Add trailing slash if no filetype. We covered that many times here. Did you try a search? 2) rewrite URL based on the final directory of the specified URL Sounds like a fairly simple regular-expressions and back-reference problem then. A pattern such as ^([^/]+/)*([^/]+)/$ with a back-reference to $2 should solve that relatively efficiently... For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com]. Jim
|
el_roboto

msg:3469776 | 9:27 am on Oct 5, 2007 (gmt 0) | thanks jim got it
|
|
|