tags:

views:

24

answers:

1

I am using PHP and I need to use a name say "Pranav dave" in url which should redirect me to "myprofile.php" what should i do?.. also the url should display me "Pranav dave".. and what should be the htaccess rule to redirect any html file to php file?

+1  A: 

You could make it like this:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ myprofile.php?profile=$1 [NC]

After that, you can use your urls like this http://example.com/Pranav dave. The only problem is, that the browser will rewrite the url, and after that, its looking like followink one http://example.com/Pranav%20dave

Nort
And what about redirecting any html file to php?
OM The Eternity
I'm not sure what you thinking about, but if you have an html file that you want to redirect, you can use for eg. javascript (`window.location = "target.php";`). But there are many ways to solve this problem. Another example with mod_rewrite: tell apache to handle html files, like php files (like this: `AddType application/x-httpd-php .html`) and so on.
Nort