...

View Full Version : How to create dynamic public user profile for my website



yuvi
08-10-2010, 09:12 AM
Hi experts,

I created my wbsite and user will register in my website and will log in.
I want to create public profile for every user like in linkedin, feacebook etc.

for ex.

www.mywebsite.com/user/username

But I don't know how to do this.
please help me..

Thanks in advance,
yuvi..

Fou-Lu
08-10-2010, 03:21 PM
Although the implementation of this will be language specific (assuming you are using JSP since this is in the Java forum), this is actually performed by apache with a module called mod_rewrite.
This looks like a pretty good tutorial and should help you get started: http://articles.sitepoint.com/article/guide-url-rewriting. The last page pretty much shows what you are looking to do.

Moving from Java to Apache Configurations.

yuvi
08-11-2010, 12:24 PM
Hello,

Thank you for turn me to the right direction. I visited that page but I don't know how to proceed. whether we have to use perl to do this or we can do this with java itself.

Help me to proceed..

I think it is the long process to go.
Can you show me any sample code in java??


Thanks and Regards,

yuvi...

Fou-Lu
08-11-2010, 05:35 PM
URL rewriting isn't done by any language. Its done by apache, you take the new url and map it back to what you want it to be which will be a querystring design.
You retrieve these in JSP from the request.getParameter method.

oracleguy
08-11-2010, 07:43 PM
So for example with URL rewriting if the user requests:

mysite.com/user/someuser
you can rewrite it so the page that is actually requested on the server (as an example) is:
mysite.com/showuser.php?user=someuser

It is language independent so it doesn't matter what server side language you are using.

yuvi
08-12-2010, 09:50 AM
But I am developing my website in netbeans IDE in java platform and my website is running in my own system localhost not in internet.

My doubt is Where Can I save .htaccess file in order to run in netbeans IDE for url rewriting?

I test this one in php in xampp and it is working. I got the result I want.

But in jsp, I can't do that.

actually my project link to view the public profile for specific user is

http://localhost:8080/project/publicprofile.jsp?userid=username

I want to rewrite as http://localhost:8080/project/username

How can I access .htaccess file for my project through netbeans IDE.

Thanks in advance,

yuvi..

Fou-Lu
08-12-2010, 03:27 PM
I'm not familiar with how the netbeans works for this, but I believe JSP often uses Apache and Tomcat to run. So I don't see an issue with using .htaccess files if thats the case.
Generally you need to make these files yourself, if you don't see one its possible that it doesn't yet exist. If it does, you can access it using any text editor including notepad.
Windows may give you a hard time making .htaccess files though. Make sure your extensions are showing, and using a command window execute echo "" > .htaccess when you are in the proper directory. This is if your on windows.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum