I have a page /users/view , that I want to show specific user profiles. I want the URL for the user to show as:
/users/12345/hisusername (where 12345 is his user id).
For the moment to get the ball rolling I've tried just going to /users/view/12345/hisusername of course that tries to find a page rather than go to users/view with request parameters.
If it's not an imbuilt config setting... then you could always create you own template with macro to display the correct data... and use the urlrewriting.config to rewrite you required url into the physical url + get paramaters.
Here's the actual comment from the \config\urlrewriting.config
Urlrewriting.Net is a cool tool, what can make your urls look nice.
The rewriting is controlled with regular expressions. To get more help
look at http://www.urlrewriting.net/.
Remember to read the manual!
http://umbraco.org/redir/urlRewritingManual
The sample below rewrites a url from
"/product/someproductid.aspx" to
"/product.aspx?productid=someproductid"
The user will not see the rewritten path! The page that will be
loaded from umbraco will instead be:
"/product.aspx?productid=someproductid"
{add name="produktidrewrite"
virtualUrl="^~/product/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/product.aspx?productid=$1"
ignoreCase="true" /}
This sample is usefull for a productpage, where the product comes from a
dynamic datasource, e.g. a database. The querystring "productid" can be loaded
from the template, into a macro, that then loads the product!
Any bugs or problems with the rewriter, contact Anders/Duckie
from that you can rewrite /users/12345/hisusername to yourProfileview.aspx?id=12345
How to process this request with Umbraco?
Hi!
I have a page /users/view , that I want to show specific user profiles. I want the URL for the user to show as:
/users/12345/hisusername (where 12345 is his user id).
For the moment to get the ball rolling I've tried just going to /users/view/12345/hisusername of course that tries to find a page rather than go to users/view with request parameters.
How can I go about this?
Hello,
Normally you should be able to define a route for this in the config files. Can you maybe specify on which version of Umbraco you are working?
Cheers,
Michael.
If it's not an imbuilt config setting... then you could always create you own template with macro to display the correct data... and use the urlrewriting.config to rewrite you required url into the physical url + get paramaters.
Here's the actual comment from the \config\urlrewriting.config
from that you can rewrite /users/12345/hisusername to yourProfileview.aspx?id=12345
something like
{add name="produktidrewrite" virtualUrl="^~/users/([\d]*)/.*.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/profileView.aspx?userid=$1" ignoreCase="true" /}
is working on a reply...