How to Rewrite URL in htaccess with php?

UserName as URL ( Apache htaccess ) PHP?

  • I am developing a PHP Web Application and I know about htaccess ( and how to create the htaccess file ). I have activated mod_rewrite in XAMPP ( I am testing it locally ). The current Profile URL is: localhost/app/user.php?name=AbhishekBiswal Where Abhishek Biswal is the UserName. I want it to look like: localhost/app/AbhishekBiswal Please include the htaccess code in your answer. Thanks In Advance.

  • Answer:

    Here you can find a nice htacces tutorial that shows how you can rewrite the urls: http://knol.google.com/k/seo-friendly-url-or-pretty-url-using-apache-mod-rewrite Ansering your question, you could try something like this: RewriteEngine on RewriteCond %{REQUEST_FILENAME}  -d RewriteRule ^([^./]+)/?$      /user.php?name=$1 [L]

Alejandro Parodi at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.