简体   繁体   中英

How do i convert my URL's like www.example.com/profile.php?id=xyz into www.example.com/xyz?

I have got different pages in my website(portal) which may take one or more parameters from the URL.

So the URL www.example.com/xyz has to be solved into or like www.example.com/profile.php?id=xyz and the value id should be able to get using GET method.

I'm working on PHP. Any answers would be highly appreciated. (I'm new to PHP and have only basic+ knowledge in it. Please explain briefly.)

To go from: www.example.com/profile.php?id=xyz into www.example.com/xyz you can use the following rule in your .htaccess file:

RewriteEngine On
RewriteRule ^([^/]*)$ /profile.php?id=$1 [L]

Just make sure you clear your cache before testing this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM