使用.htaccess
我已经能够转换网址:
http://www.websitename.co.uk/directory/users.php?id=idValue&data2=data2Value
到
http://www.websitename.co.uk/directory/users?id=idValue&data2=data2Value
htaccess的:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
然而,我更愿意看到它变成了这个:
http://www.websitename.co.uk/directory/users/idValue?data2=data2Value
我希望这是有道理的,因为现在只需回显idValue,我就需要PHP方面的帮助,因为我不确定如何?
答案 0 :(得分:0)
RewriteRule ^directory/users/([0-9_]+)/([A-Za-z0-9_]+)$ directory/users.php?id=$1&data2=$2 [L,QSA]