开发者

htaccess rule for redirection of any particular name to particular page

开发者 https://www.devze.com 2023-01-01 07:45 出处:网络
I am using PHP and I need to use a name say \"Pranav dave\" in url which s开发者_StackOverflow中文版hould redirect me to \"myprofile.php\" what should i do?.. also the url should display me \"Pranav d

I am using PHP and I need to use a name say "Pranav dave" in url which s开发者_StackOverflow中文版hould 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消