I saw many website user page is like
www.xyz.com/hhh

From these complete information can be retrive of "hhh" user.

I want to know that how www.xyz.com?username=hhh can be convert to www.xyz/hhh
Any help

Recommended Answers

All 9 Replies

i think it is not possible

i think it is not possible

Well, actually it is. It's called url rewrite. Maybe this link can help you understand how it works in an Apache webserver.

To achieve this you should use frameworks or move to use url encode options.

In order to achieved this, you, would have to use url re-write (like @Nichito pointed out)

You would still have your username.php which accepts the paramater (hh).

<?php

  $user = $_GET['username']; // Obviously with a bit more security 

  var_dump($user);

  ?>

Hope this helps

please provide more clear example...

http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html

See example #4.

Its not workin . I have already .htaccess file and i added in the last but its not working

my .htaccess file is as follow..

RewriteEngine On
Options +Followsymlinks
RewriteBase /

    ## Dissable directory indexing ##
    Options -Indexes

## Remove trailing slash from end of uri ##
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]

# Redirect to non.php extension
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/)*[^.]+\.php(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$  $1 [R=301,L]

## Rewrite Rules ##
RewriteRule ^([0-9-a-z-A-Z-_]+)/?$ goto.php?id=$1 [L]
RewriteRule ^account/(.*)$  $1.php [L]


RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

Please check this and reply.....

Your first rewrite redirects redirects all non files, and following rules will not be processed. I think it is getting in the way.

It is called URL rewriting using Apache server htaccess configuration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.