我想从
更改网址http://mywebsite/address.php?state=oh&office_id=1425
到
http://mywebsite/office/{variable inside my php page}.php
感谢您能帮助我
答案 0 :(得分:3)
这应该有效:
RewriteEngine On
RewriteRule ^office/([0-9]+).php$ address.php?state=oh&office_id=$1
哪会导致:
http://expample.com/office/1425.php
或者如果您希望状态也是动态的,您可以这样做:
RewriteEngine On
RewriteRule ^office/([a-zA-Z]+)/([0-9]+).php$ address.php?state=$1&office_id=$2
哪会导致:
http://expample.com/office/oh/1425.php
答案 1 :(得分:1)
我建议看一下 mod_rewrite Apache模块。 您可以使用它进行各种URL操作。
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
初学者指南: